aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge D. Plymale II2017-04-20 14:05:11 -0400
committerNoam Postavsky2017-04-20 23:03:10 -0400
commite8875bcbe067ea020dba95530ec4e9485942babd (patch)
treea52161f7387a57035a231d0d0624eac14550baf9
parenta6b375ba4bfc9453abc428dcb73e65bfcf61b794 (diff)
downloademacs-e8875bcbe067ea020dba95530ec4e9485942babd.tar.gz
emacs-e8875bcbe067ea020dba95530ec4e9485942babd.zip
Treat non-erroring lisp call as successful eshell command (Bug#26161)
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
-rw-r--r--lisp/eshell/esh-cmd.el12
1 files changed, 4 insertions, 8 deletions
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 583ba6ac42f..86e7b83c281 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -575,14 +575,9 @@ must be implemented via rewriting, rather than as a function."
575(defvar eshell-last-command-result) ;Defined in esh-io.el. 575(defvar eshell-last-command-result) ;Defined in esh-io.el.
576 576
577(defun eshell-exit-success-p () 577(defun eshell-exit-success-p ()
578 "Return non-nil if the last command was \"successful\". 578 "Return non-nil if the last command was successful.
579For a bit of Lisp code, this means a return value of non-nil. 579This means an exit code of 0."
580For an external command, it means an exit code of 0." 580 (= eshell-last-command-status 0))
581 (if (save-match-data
582 (string-match "#<\\(Lisp object\\|function .*\\)>"
583 eshell-last-command-name))
584 eshell-last-command-result
585 (= eshell-last-command-status 0)))
586 581
587(defvar eshell--cmd) 582(defvar eshell--cmd)
588 583
@@ -1257,6 +1252,7 @@ represent a lisp form; ARGS will be ignored in that case."
1257 (and result (funcall printer result)) 1252 (and result (funcall printer result))
1258 result) 1253 result)
1259 (error 1254 (error
1255 (setq eshell-last-command-status 1)
1260 (let ((msg (error-message-string err))) 1256 (let ((msg (error-message-string err)))
1261 (if (and (not form-p) 1257 (if (and (not form-p)
1262 (string-match "^Wrong number of arguments" msg) 1258 (string-match "^Wrong number of arguments" msg)