* 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.
(cons (byte-optimize-form (nth 1 form) for-effect)
(byte-optimize-body (cdr (cdr form)) t)))
(byte-optimize-form (nth 1 form) for-effect)))
- ((eq fn 'prog2)
- (cons 'prog2
- (cons (byte-optimize-form (nth 1 form) t)
- (cons (byte-optimize-form (nth 2 form) for-effect)
- (byte-optimize-body (cdr (cdr (cdr form))) t)))))
((memq fn '(save-excursion save-restriction save-current-buffer))
;; those subrs which have an implicit progn; it's not quite good
(put 'progn 'byte-hunk-handler 'byte-compile-file-form-progn)
(put 'prog1 'byte-hunk-handler 'byte-compile-file-form-progn)
-(put 'prog2 'byte-hunk-handler 'byte-compile-file-form-progn)
(defun byte-compile-file-form-progn (form)
- (mapc 'byte-compile-file-form (cdr form))
+ (mapc #'byte-compile-file-form (cdr form))
;; Return nil so the forms are not output twice.
nil)
(byte-defop-compiler-1 inline byte-compile-progn)
(byte-defop-compiler-1 progn)
(byte-defop-compiler-1 prog1)
-(byte-defop-compiler-1 prog2)
(byte-defop-compiler-1 if)
(byte-defop-compiler-1 cond)
(byte-defop-compiler-1 and)
(byte-compile-form-do-effect (car (cdr form)))
(byte-compile-body (cdr (cdr form)) t))
-(defun byte-compile-prog2 (form)
- (byte-compile-form (nth 1 form) t)
- (byte-compile-form-do-effect (nth 2 form))
- (byte-compile-body (cdr (cdr (cdr form))) t))
-
(defmacro byte-compile-goto-if (cond discard tag)
`(byte-compile-goto
(if ,cond
(`(,func . ,forms)
;; First element is function or whatever function-like forms are: or, and,
- ;; if, catch, progn, prog1, prog2, while, until
+ ;; if, catch, progn, prog1, while, until
`(,func . ,(mapcar (lambda (form)
(cconv-convert form env extend))
forms)))
`(setf ,cps--value-symbol ,temp-var-symbol
,cps--state-symbol ,next-state))))))))
- ;; Process `prog2'.
-
- (`(prog2 ,form1 ,form2 . ,body)
- (cps--transform-1
- `(progn ,form1 (prog1 ,form2 ,@body))
- next-state))
-
;; Process `unwind-protect': If we're inside an unwind-protect, we
;; have a block of code UNWINDFORMS which we would like to run
;; whenever control flows away from the main piece of code,
(put 'autoload 'lisp-indent-function 'defun) ;Elisp
(put 'progn 'lisp-indent-function 0)
(put 'prog1 'lisp-indent-function 1)
-(put 'prog2 'lisp-indent-function 2)
(put 'save-excursion 'lisp-indent-function 0) ;Elisp
(put 'save-restriction 'lisp-indent-function 0) ;Elisp
(put 'save-current-buffer 'lisp-indent-function 0) ;Elisp
;; 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);
return val;
}
-DEFUN ("prog2", Fprog2, Sprog2, 2, UNEVALLED, 0,
- doc: /* 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.
-usage: (prog2 FORM1 FORM2 BODY...) */)
- (Lisp_Object args)
-{
- eval_sub (XCAR (args));
- return Fprog1 (XCDR (args));
-}
-
DEFUN ("setq", Fsetq, Ssetq, 0, UNEVALLED, 0,
doc: /* Set each SYM to the value of its VAL.
The symbols SYM are variables; they are literal (not evaluated).
defsubr (&Scond);
defsubr (&Sprogn);
defsubr (&Sprog1);
- defsubr (&Sprog2);
defsubr (&Ssetq);
defsubr (&Squote);
defsubr (&Sfunction);