From beb9c26d4c788de775f1ec2c6504a2ecff1f1d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Thu, 12 Feb 2026 12:20:39 +0100 Subject: [PATCH] ; Simplify 'prog1' optimiser * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Drop unnecessary condition. Noticed by Pip Cet. --- lisp/emacs-lisp/byte-opt.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 1aecae5ac7d..0290a2fd6ca 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -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))) - (cond ((null exps-opt) exp-opt) - ((macroexp-const-p exp-opt) `(progn ,@exps-opt ,exp-opt)) - (t `(,fn ,exp-opt ,@exps-opt)))) - exp-opt))) + (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))))) (`(,(or `save-excursion `save-restriction `save-current-buffer) . ,exps) ;; Those subrs which have an implicit progn; it's not quite good