]> git.eshelyaron.com Git - emacs.git/commitdiff
Treat non-erroring lisp call as successful eshell command (Bug#26161)
authorGeorge D. Plymale II <georgedp@orbitalimpact.com>
Thu, 20 Apr 2017 18:05:11 +0000 (14:05 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Fri, 21 Apr 2017 03:03:10 +0000 (23:03 -0400)
This lets a compound command like 'cd .. && echo ok' print 'ok',
similar to how most other shells behave.

* lisp/eshell/esh-cmd.el (eshell-exit-success-p): Only check if the
last exit code was zero, rather than first checking whether the last
command returned nil.
(eshell-exec-lisp): Set `eshell-last-command-status' to 1 on error.

Copyright-paperwork-exempt: yes

lisp/eshell/esh-cmd.el

index 583ba6ac42f6c8e42edd0fbc0cc4c78112956a9e..86e7b83c2817e2f0d1f7d910e82b308cea363949 100644 (file)
@@ -575,14 +575,9 @@ must be implemented via rewriting, rather than as a function."
 (defvar eshell-last-command-result)     ;Defined in esh-io.el.
 
 (defun eshell-exit-success-p ()
-  "Return non-nil if the last command was \"successful\".
-For a bit of Lisp code, this means a return value of non-nil.
-For an external command, it means an exit code of 0."
-  (if (save-match-data
-       (string-match "#<\\(Lisp object\\|function .*\\)>"
-                     eshell-last-command-name))
-      eshell-last-command-result
-    (= eshell-last-command-status 0)))
+  "Return non-nil if the last command was successful.
+This means an exit code of 0."
+  (= eshell-last-command-status 0))
 
 (defvar eshell--cmd)
 
@@ -1257,6 +1252,7 @@ represent a lisp form; ARGS will be ignored in that case."
         (and result (funcall printer result))
         result)
     (error
+     (setq eshell-last-command-status 1)
      (let ((msg (error-message-string err)))
        (if (and (not form-p)
                 (string-match "^Wrong number of arguments" msg)