Skip to content

Instantly share code, notes, and snippets.

@hchbaw
Created May 12, 2010 12:36
Show Gist options
  • Save hchbaw/398528 to your computer and use it in GitHub Desktop.
Save hchbaw/398528 to your computer and use it in GitHub Desktop.
;; http://repo.or.cz/w/emacs.git/blob/HEAD:/src/fileio.c#l5557
;; (install-my-restore-message-function alcs-make-candidates)
(defmacro w/uniq (names &rest body)
(declare (indent 1))
`(let ,(mapcar (lambda (s) `(,s (gensym ,(symbol-name s))))
(if (consp names) names (list names)))
,@body))
(defmacro with-my-restore-message (&rest body)
(w/uniq gm
`(let ((,gm (current-message)))
(unwind-protect ,@body
(when ,gm
(let (message-log-max)
(sit-for 1)
(message ,gm)))))))
(defmacro install-my-restore-message-function-1 (function)
`(defadvice ,function (around my-restore-message activate)
(with-my-restore-message ad-do-it)))
(defmacro install-my-restore-message-function (&rest funs)
`(progn
,@(mapcar (lambda (f) `(install-my-restore-message-function-1 ,f))
(if (consp funs) funs (list funs)))))
(install-my-restore-message-function alcs-make-candidates)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment