* lisp/emacs-lisp/cl-macs.el (cl--prog): New function
(cl-prog, cl-prog*): New macros.
This commit is contained in:
parent
3698c4e475
commit
9c8c3a5478
1 changed files with 21 additions and 0 deletions
|
@ -1808,6 +1808,27 @@ Labels have lexical scope and dynamic extent."
|
|||
`(throw ',catch-tag ',label))))
|
||||
,@macroexpand-all-environment)))))
|
||||
|
||||
(defun cl--prog (binder bindings body)
|
||||
(let (decls)
|
||||
(while (eq 'declare (car-safe (car body)))
|
||||
(push (pop body) decls))
|
||||
`(cl-block nil
|
||||
(,binder ,bindings
|
||||
,@(nreverse decls)
|
||||
(cl-tagbody . ,body)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro cl-prog (bindings &rest body)
|
||||
"Run BODY like a `cl-tagbody' after setting up the BINDINGS.
|
||||
Shorthand for (cl-block nil (let BINDINGS (cl-tagbody BODY)))"
|
||||
(cl--prog 'let bindings body))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro cl-prog* (bindings &rest body)
|
||||
"Run BODY like a `cl-tagbody' after setting up the BINDINGS.
|
||||
Shorthand for (cl-block nil (let* BINDINGS (cl-tagbody BODY)))"
|
||||
(cl--prog 'let* bindings body))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro cl-do-symbols (spec &rest body)
|
||||
"Loop over all symbols.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue