diff options
| author | Richard M. Stallman | 2002-02-20 22:33:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-02-20 22:33:01 +0000 |
| commit | 94ddbe6d9ec955c1f63d7bb0df10744657007df1 (patch) | |
| tree | 5f6fbdb9d587a561a798549db09293a281e7b0a5 | |
| parent | 61a3d8c4c42075b2b47d0617876e3e65a5774295 (diff) | |
| download | emacs-94ddbe6d9ec955c1f63d7bb0df10744657007df1.tar.gz emacs-94ddbe6d9ec955c1f63d7bb0df10744657007df1.zip | |
(shell-command-on-region): Display the exit status when a command fails.
| -rw-r--r-- | lisp/simple.el | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 6708af57a2c..6a0808c2cd6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1482,14 +1482,20 @@ specifies the value of ERROR-BUFFER." | |||
| 1482 | (with-current-buffer buffer | 1482 | (with-current-buffer buffer |
| 1483 | (save-excursion | 1483 | (save-excursion |
| 1484 | (goto-char (point-max)) | 1484 | (goto-char (point-max)) |
| 1485 | (insert "...Shell command failed")))) | 1485 | (insert (format "...Shell command failed with code %d" |
| 1486 | exit-status))))) | ||
| 1486 | (display-message-or-buffer buffer)) | 1487 | (display-message-or-buffer buffer)) |
| 1487 | ;; No output; error? | 1488 | ;; No output; error? |
| 1488 | (message (if (and error-file | 1489 | (let ((output |
| 1489 | (< 0 (nth 7 (file-attributes error-file)))) | 1490 | (if (and error-file |
| 1490 | "(Shell command %sed with some error output)" | 1491 | (< 0 (nth 7 (file-attributes error-file)))) |
| 1491 | "(Shell command %sed with no output)") | 1492 | "some error output" |
| 1492 | (if (equal 0 exit-status) "succeed" "fail")) | 1493 | "no output"))) |
| 1494 | (if (equal 0 exit-status) | ||
| 1495 | (message "(Shell command succeeded with %s)" | ||
| 1496 | output) | ||
| 1497 | (message "(Shell command failed with code %d and %s)" | ||
| 1498 | exit-status output))) | ||
| 1493 | ;; Don't kill: there might be useful info in the undo-log. | 1499 | ;; Don't kill: there might be useful info in the undo-log. |
| 1494 | ;; (kill-buffer buffer) | 1500 | ;; (kill-buffer buffer) |
| 1495 | )))) | 1501 | )))) |
| @@ -1927,7 +1933,9 @@ See also the command \\[yank-pop]." | |||
| 1927 | ((eq arg '-) -1) | 1933 | ((eq arg '-) -1) |
| 1928 | (t (1- arg))))) | 1934 | (t (1- arg))))) |
| 1929 | (let ((inhibit-read-only t)) | 1935 | (let ((inhibit-read-only t)) |
| 1930 | (remove-text-properties opoint (point) '(read-only nil)))) | 1936 | ;; Clear `field' property for the sake of copying from the |
| 1937 | ;; minibuffer prompt or a *shell* prompt. | ||
| 1938 | (remove-text-properties opoint (point) '(read-only nil field nil)))) | ||
| 1931 | (if (consp arg) | 1939 | (if (consp arg) |
| 1932 | ;; This is like exchange-point-and-mark, but doesn't activate the mark. | 1940 | ;; This is like exchange-point-and-mark, but doesn't activate the mark. |
| 1933 | ;; It is cleaner to avoid activation, even though the command | 1941 | ;; It is cleaner to avoid activation, even though the command |