Skip to content

Instantly share code, notes, and snippets.

@xuchunyang
Created April 17, 2015 06:29
Show Gist options
  • Save xuchunyang/eb9cf96cf11faa4793db to your computer and use it in GitHub Desktop.
Save xuchunyang/eb9cf96cf11faa4793db to your computer and use it in GitHub Desktop.
elisp-advice-function.el
;;; Advice Functions
(defun my-tracing-function (orig-fun &rest args)
"My tracing functions."
;; (message "Old buffer name" (buffer-name))
(message "ace-window called with args %S" args)
(let ((res (apply orig-fun args)))
(message "ace-window returned %S" res)
res))
;;; Higher
(advice-add 'ace-window :around #'my-tracing-function)
(advice-remove 'ace-window #'my-tracing-function)
;;; Lower
(add-function :around (symbol-function 'ace-window) #'my-tracing-function)
(remove-function (symbol-function 'ace-window) #'my-tracing-function)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment