Created
February 12, 2010 16:02
-
-
Save hchbaw/302684 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro with-my-anything-follow-mode (push-mark &rest body) | |
(declare (indent 1)) | |
(let ((gf (gensym))) | |
`(letf (((symbol-function 'push-mark) | |
(symbol-function 'ignore))) | |
(letf* ((,gf | |
(symbol-function 'anything-initialize-overlays)) | |
((symbol-function 'anything-initialize-overlays) | |
(lambda (buffer) | |
(funcall ,gf buffer) | |
(anything-follow-mode t)))) | |
,(when push-mark '(push-mark)) | |
,@body)))) | |
(defmacro install-my-anything-follow-mode-command | |
(command &optional no-push-mark) | |
`(defadvice ,command (around turn-on-anything-follow-mode activate) | |
(with-my-anything-follow-mode ,(not no-push-mark) ad-do-it))) | |
;; 例 | |
(install-my-anything-follow-mode-command anything-apropos) | |
;; (install-my-anything-follow-mode-command anything) ;; ^^; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment