Skip to content

Instantly share code, notes, and snippets.

@hchbaw
Created February 12, 2010 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hchbaw/302684 to your computer and use it in GitHub Desktop.
Save hchbaw/302684 to your computer and use it in GitHub Desktop.
(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