diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-02-22 23:50:03 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-02-22 23:50:03 -0500 |
commit | e846bbf360d1bcee3a35dd05a57bc76cbb22a6f0 (patch) | |
tree | 6405207140152b44c5f4a862ce427e2912383ad7 /lisp/emacs-lisp/macroexp.el | |
parent | 3f006e1d47c25a8282fd41fb0df01fd80f486b9e (diff) | |
download | emacs-e846bbf360d1bcee3a35dd05a57bc76cbb22a6f0.tar.gz emacs-e846bbf360d1bcee3a35dd05a57bc76cbb22a6f0.tar.bz2 emacs-e846bbf360d1bcee3a35dd05a57bc76cbb22a6f0.zip |
* lisp/emacs-lisp/macroexp.el (macroexp-parse-body): Handle cl-declare
and :documentation. Change return value format accordingly.
* lisp/emacs-lisp/cl-generic.el (cl--generic-lambda):
* lisp/emacs-lisp/pcase.el (pcase-lambda): Adjust accordingly.
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Use macroexp-parse-body.
Diffstat (limited to 'lisp/emacs-lisp/macroexp.el')
-rw-r--r-- | lisp/emacs-lisp/macroexp.el | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index b75c8cc50a7..68bf4f62c34 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -297,15 +297,16 @@ definitions to shadow the loaded ones for use in file byte-compilation." ;;; Handy functions to use in macros. -(defun macroexp-parse-body (exps) - "Parse EXPS into ((DOC DECLARE-FORM INTERACTIVE-FORM) . BODY)." - `((,(and (stringp (car exps)) - (pop exps)) - ,(and (eq (car-safe (car exps)) 'declare) - (pop exps)) - ,(and (eq (car-safe (car exps)) 'interactive) - (pop exps))) - ,@exps)) +(defun macroexp-parse-body (body) + "Parse a function BODY into (DECLARATIONS . EXPS)." + (let ((decls ())) + (while (and (cdr body) + (let ((e (car body))) + (or (stringp e) + (memq (car-safe e) + '(:documentation declare interactive cl-declare))))) + (push (pop body) decls)) + (cons (nreverse decls) body))) (defun macroexp-progn (exps) "Return an expression equivalent to `(progn ,@EXPS)." |