summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-04-02 09:51:20 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-04-02 10:04:44 -0400
commit84616144ca206ef9a92bd0cd2507376f42bfe3e6 (patch)
treefebf9d92f37b18c6982c2a71ad225dc5c9154ae8 /lisp/subr.el
parent3e8f9482fe2288baedd9cc5026e25ffc543683ab (diff)
downloademacs-84616144ca206ef9a92bd0cd2507376f42bfe3e6.tar.gz
* lisp/subr.el (prog2): Define as a macro
* src/eval.c (Fprog2): Delete function. (syms_of_eval): Don't register it. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): * lisp/emacs-lisp/generator.el (cps--transform-1): Remove `prog2` case. * lisp/emacs-lisp/bytecomp.el (prog2): Remove handlers. (byte-compile-prog2): Delete. * lisp/emacs-lisp/lisp-mode.el (prog2): Remove property.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 6a9492a3a7a..8d51474b0c9 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -118,6 +118,13 @@ BODY should be a list of Lisp expressions.
;; depend on backquote.el.
(list 'function (cons 'lambda cdr)))
+(defmacro prog2 (form1 form2 &rest body)
+ "Eval FORM1, FORM2 and BODY sequentially; return value from FORM2.
+The value of FORM2 is saved during the evaluation of the
+remaining args, whose values are discarded."
+ (declare (indent 2) (debug t))
+ `(progn ,form1 (prog1 ,form2 ,@body)))
+
(defmacro setq-default (&rest args)
"Set the default value of variable VAR to VALUE.
VAR, the variable name, is literal (not evaluated);