From f6ad218d8fce477b9b97ab247f932577a6d44189 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Fri, 19 Jul 2024 18:07:36 -0700 Subject: [PATCH 1/2] ; 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. --- lisp/eshell/esh-cmd.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 @@ eshell-do-eval (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 @@ eshell-do-eval (setq args (cdr args))))) (cond ((eq (car form) 'progn) - (car (last form))) + (car (last (cdr form)))) ((eq (car form) 'prog1) (cadr form)) (t -- 2.25.1