[PATCH] emacs: Avoid deprecated function flet

Subject: [PATCH] emacs: Avoid deprecated function flet

Date: Sun, 19 May 2013 11:14:07 -0400

To: notmuch@notmuchmail.org

Cc:

From: Austin Clements


flet was deprecated in Emacs 24.3 and replaced with cl-flet.  However,
cl-flet lexically binds the function symbol, while we depend on flet
dynamically binding the function symbol.  Hence, this patch replaces
the deprecated flet use with letf, which lets us dynamically bind the
function symbol, while remaining compatible with both Emacs 23 and 24.

Since we don't have an automated test for this, this was tested
manually in Emacs 24.3 and 23.4.
---
 emacs/notmuch-show.el |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 423dd58..7101236 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -539,8 +539,9 @@ message at DEPTH in the current thread."
 		    (nth nth)
 		    (filename filename)
 		    (content-type content-type))
-	(flet ((mm-save-part (&rest args) (notmuch-show-save-part
-					   message-id nth filename content-type)))
+	(letf (((symbol-function 'mm-save-part)
+		(lambda (&rest args) (notmuch-show-save-part
+				      message-id nth filename content-type))))
 	  (mm-display-part handle))))))
 
 (defun notmuch-show-interactively-view-part (message-id nth &optional filename content-type)
-- 
1.7.10.4


Thread: