]> git.eshelyaron.com Git - emacs.git/commitdiff
; Improve correctness of 'eshell-do-eval' in some edge cases
authorJim Porter <jporterbugs@gmail.com>
Sat, 20 Jul 2024 01:07:36 +0000 (18:07 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 29 Jul 2024 17:16:14 +0000 (19:16 +0200)
* 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)

lisp/eshell/esh-cmd.el

index 2b47962735a70eda1485e9dd0bd1701edfba8dd6..43d536ac463d623b285a9450910bf59445ac8945 100644 (file)
@@ -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