diff options
author | Daniel Colascione <dancol@dancol.org> | 2015-03-02 16:11:51 -0800 |
---|---|---|
committer | Daniel Colascione <dancol@dancol.org> | 2015-03-02 16:11:51 -0800 |
commit | 8f0f8c166c2c76789acfa0cf3d42eafbbfa95973 (patch) | |
tree | 40da1478fee4daf746648ed9a638a61919e5ee41 /lisp/emacs-lisp | |
parent | f6b5db6c45b773f86e203368aee9153ec8527205 (diff) | |
download | emacs-8f0f8c166c2c76789acfa0cf3d42eafbbfa95973.tar.gz emacs-8f0f8c166c2c76789acfa0cf3d42eafbbfa95973.tar.bz2 emacs-8f0f8c166c2c76789acfa0cf3d42eafbbfa95973.zip |
Fix docstrings, declarations in iter-defun
* lisp/emacs-lisp/generator.el (iter-defun): Correctly propagate
docstrings and declarations to underlying function.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/generator.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el index 4e21e792406..bb9fcff1408 100644 --- a/lisp/emacs-lisp/generator.el +++ b/lisp/emacs-lisp/generator.el @@ -674,10 +674,16 @@ encapsulates the state of a computation that produces a sequence of values. Callers can retrieve each value using `iter-next'." (declare (indent defun)) (cl-assert lexical-binding) - `(defun ,name ,arglist - ,(cps-generate-evaluator - `(cl-macrolet ((iter-yield (value) `(cps-internal-yield ,value))) - ,@body)))) + (let (preamble) + (when (stringp (car body)) + (push (pop body) preamble)) + (when (eq (car-safe (car body)) 'declare) + (push (pop body) preamble)) + `(defun ,name ,arglist + ,@(nreverse preamble) + ,(cps-generate-evaluator + `(cl-macrolet ((iter-yield (value) `(cps-internal-yield ,value))) + ,@body))))) (defmacro iter-lambda (arglist &rest body) "Return a lambda generator. |