Make let-around inherit interactive forms

This commit is contained in:
Ivan Malison 2016-08-12 14:32:26 -07:00
parent bfcece5800
commit 2a4485a47a
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -599,9 +599,23 @@ the ~:around~ keyword of advice-add.
(defmacro imalison:let-around-fn (orig-func &rest forms)
`(lambda (&rest args)
(let ,forms
(apply ,orig-func args))))
(apply (quote ,orig-func) args))))
#+END_SRC
(imalison:named-builder imalison:let-around)
#+BEGIN_SRC emacs-lisp
(defmacro imalison:let-around (new-function-name function-name &rest args)
(let* ((orig-interactive-form (interactive-form function-name))
(additional-forms
(when orig-interactive-form
(list
`(put (quote ,new-function-name) 'interactive-form
(quote ,orig-interactive-form))))))
`(progn
(defalias (quote ,new-function-name)
(imalison:let-around-fn ,function-name ,@args))
,@additional-forms)))
(put 'imalison:let-around 'lisp-indent-function 1)
#+END_SRC
**** Dynamically, using functions
#+BEGIN_SRC emacs-lisp