branch: externals/ergoemacs-mode commit 6f703fee9ee3157b49523cbf38331ddf6aef6aad Author: Walter Landry <wlan...@caltech.edu> Commit: Walter Landry <wlan...@caltech.edu>
Remove ergoemacs-advice --- ergoemacs-macros.el | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el index b749b0d..b8e73d9 100644 --- a/ergoemacs-macros.el +++ b/ergoemacs-macros.el @@ -282,58 +282,6 @@ When arg1 can be a property. The following properties are supported: (t `(ergoemacs-map-- ,arg1))))) -;;;###autoload -(defmacro ergoemacs-advice (function args &rest body-and-plist) - "Defines an `ergoemacs-mode' advice. - -The structure is (ergoemacs-advice function args tags body-and-plist) - -When the tag :type equals :replace, the advice replaces the function. - -When :type is :replace that replaces a function (like `define-key')" - (declare (doc-string 2) - (indent 2)) - (let ((kb (make-symbol "kb"))) - (setq kb (ergoemacs-theme-component--parse-keys-and-body `(nil nil ,@body-and-plist))) - (cond - ((eq (plist-get (nth 0 kb) :type) :around) - ;; FIXME: use `nadvice' for emacs 24.4+ - (macroexpand-all `(progn - (defadvice ,function (around ,(intern (format "ergoemacs-advice--%s" (symbol-name function))) ,args activate) - ,(plist-get (nth 0 kb) :description) - ,@(nth 1 kb))))) - ((eq (plist-get (nth 0 kb) :type) :after) - ;; FIXME: use `nadvice' for emacs 24.4+ - (macroexpand-all - `(progn - (defadvice ,function (after ,(intern (format "ergoemacs-advice--after-%s" (symbol-name function))) ,args activate) - ,(plist-get (nth 0 kb) :description) - ,@(nth 1 kb))))) - ((eq (plist-get (nth 0 kb) :type) :before) - ;; FIXME: use `nadvice' for emacs 24.4+ - (macroexpand-all `(progn - (defadvice ,function (before ,(intern (format "ergoemacs-advice--%s" (symbol-name function))) ,args activate) - ,(plist-get (nth 0 kb) :description) - ,@(nth 1 kb))))) - ((eq (plist-get (nth 0 kb) :type) :replace) - (macroexpand-all `(progn - (defalias ',(intern (format "ergoemacs-advice--real-%s" (symbol-name function))) - (symbol-function ',function) (concat ,(format "ARGS=%s\n\n" args) (documentation ',function) - ,(format "\n\n`ergoemacs-mode' preserved the real `%s' in this function." - (symbol-name function)))) - (defun ,(intern (format "ergoemacs-advice--%s--" function)) ,args - ,(format "%s\n\n%s\n\n`ergoemacs-mode' replacement function for `%s'.\nOriginal function is preserved in `ergoemacs-advice--real-%s'" - (documentation function) - (plist-get (nth 0 kb) :description) (symbol-name function) (symbol-name function)) - ,@(nth 1 kb)) - ;; Hack to make sure the documentation is in the function... - (defalias ',(intern (format "ergoemacs-advice--%s" function)) ',(intern (format "ergoemacs-advice--%s--" function)) - ,(format "ARGS=%s\n\n%s\n\n%s\n\n`ergoemacs-mode' replacement function for `%s'.\nOriginal function is preserved in `ergoemacs-advice--real-%s'" - args (documentation function) (plist-get (nth 0 kb) :description) (symbol-name function) (symbol-name function))) - ,(if (plist-get (nth 0 kb) :always) - `(push ',function ergoemacs-advice--permanent-replace-functions) - `(push ',function ergoemacs-advice--temp-replace-functions)))))))) - (defmacro ergoemacs-cache (item &rest body) "Either read ITEM's cache or evaluate BODY, cache ITEM and return value." (declare (indent 1))