; Simplify 'prog1' optimiser

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Drop unnecessary condition.  Noticed by Pip Cet.
This commit is contained in:
Mattias Engdegård 2026-02-12 12:20:39 +01:00
parent b12a068352
commit beb9c26d4c

View file

@ -341,14 +341,13 @@ There can be multiple entries for the same NAME if it has several aliases.")
(if (cdr exps)
(macroexp-progn (byte-optimize-body exps for-effect))
(byte-optimize-form (car exps) for-effect)))
(`(prog1 ,exp . ,exps)
(let ((exp-opt (byte-optimize-form exp for-effect)))
(if exps
(let ((exps-opt (byte-optimize-body exps t)))
(let ((exp-opt (byte-optimize-form exp for-effect))
(exps-opt (byte-optimize-body exps t)))
(cond ((null exps-opt) exp-opt)
((macroexp-const-p exp-opt) `(progn ,@exps-opt ,exp-opt))
(t `(,fn ,exp-opt ,@exps-opt))))
exp-opt)))
(t `(,fn ,exp-opt ,@exps-opt)))))
(`(,(or `save-excursion `save-restriction `save-current-buffer) . ,exps)
;; Those subrs which have an implicit progn; it's not quite good