'cancel-timer
'delete-itimer))
-;; Emacs 24 renamed flet to cl-flet.
-(defalias 'mh-cl-flet
- (if (fboundp 'cl-flet)
- 'cl-flet
- 'flet))
+;; Emacs 24 made flet obsolete and suggested either cl-flet or
+;; cl-letf. This macro is based upon gmm-flet from Gnus.
+(defmacro mh-flet (bindings &rest body)
+ "Make temporary overriding function definitions.
+This is an analogue of a dynamically scoped `let' that operates on
+the function cell of FUNCs rather than their value cell.
+
+\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
+ (if (fboundp 'cl-letf)
+ `(cl-letf ,(mapcar (lambda (binding)
+ `((symbol-function ',(car binding))
+ (lambda ,@(cdr binding))))
+ bindings)
+ ,@body)
+ `(flet ,bindings ,@body)))
+(put 'mh-flet 'lisp-indent-function 1)
+(put 'mh-flet 'edebug-form-spec
+ '((&rest (sexp sexp &rest form)) &rest form))
(defun mh-display-color-cells (&optional display)
"Return the number of color cells supported by DISPLAY.
(buffer-read-only nil))
(when (string-match "^[^% \t]+$" method)
(setq method (concat method " %s")))
- (mh-cl-flet
+ (mh-flet
((mm-handle-set-external-undisplayer
(handle function)
(mh-handle-set-external-undisplayer folder handle function)))
(let ((handles ())
(folder mh-show-folder-buffer)
(raw-message-data (buffer-string)))
- (mh-cl-flet
+ (mh-flet
((mm-handle-set-external-undisplayer
(handle function)
(mh-handle-set-external-undisplayer folder handle function)))
(function (get-text-property (point) 'mh-callback))
(buffer-read-only nil)
(folder mh-show-folder-buffer))
- (mh-cl-flet
+ (mh-flet
((mm-handle-set-external-undisplayer
(handle function)
(mh-handle-set-external-undisplayer folder handle function)))
(mm-inline-media-tests mh-mm-inline-media-tests)
(data (get-text-property (point) 'mh-data))
(function (get-text-property (point) 'mh-callback)))
- (mh-cl-flet
+ (mh-flet
((mm-handle-set-external-undisplayer
(handle func)
(mh-handle-set-external-undisplayer folder handle func)))
(defun mh-display-emphasis ()
"Display graphical emphasis."
(when (and mh-graphical-emphasis-flag (mh-small-show-buffer-p))
- (mh-cl-flet
+ (mh-flet
((article-goto-body ())) ; shadow this function to do nothing
(save-excursion
(goto-char (point-min))
(interactive)
;; Don't allow Gnus to create buttons while highlighting, maybe this is bad
;; style?
- (mh-cl-flet
+ (mh-flet
((gnus-article-add-button (&rest args) nil))
(let* ((modified (buffer-modified-p))
(gnus-article-buffer (buffer-name))
(defun mh-thread-set-tables (folder)
"Use the tables of FOLDER in current buffer."
- (mh-cl-flet
+ (mh-flet
((mh-get-table (symbol)
(with-current-buffer folder
(symbol-value symbol))))