From: Jim Porter Date: Sat, 20 Jul 2024 01:07:36 +0000 (-0700) Subject: ; Improve correctness of 'eshell-do-eval' in some edge cases X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bbde2db75098693646a6806573b76649a124d62b;p=emacs.git ; Improve correctness of 'eshell-do-eval' in some edge cases * lisp/eshell/esh-cmd.el (eshell-do-eval): Make sure that replacing 'if' forms returns the correct result, and evaluate to 'nil' for 'progn' forms with no body. (cherry picked from commit 8bfdee8689f8b99f353179898e922ec3d975a113) --- diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 2b47962735a..43d536ac463 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -1159,7 +1159,7 @@ have been replaced by constants." (t (caddr args))))) ; Zero or one ELSE forms (unless (consp new-form) - (setq new-form (cons 'progn new-form))) + (setq new-form `(progn ,new-form))) (setcar form (car new-form)) (setcdr form (cdr new-form)))) (eshell-do-eval form synchronous-p)) @@ -1261,7 +1261,7 @@ have been replaced by constants." (setq args (cdr args))))) (cond ((eq (car form) 'progn) - (car (last form))) + (car (last (cdr form)))) ((eq (car form) 'prog1) (cadr form)) (t