diff options
| author | Richard M. Stallman | 2001-12-13 07:43:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-12-13 07:43:28 +0000 |
| commit | 2e0336939b4de5ada6f033ba02c42bf9a13e9dfc (patch) | |
| tree | 1d01451f53adc77228d4e4c4ec9f4c8a5779c666 /lisp/simple.el | |
| parent | 5a60d1da140c221942217888fecae6fb140a0732 (diff) | |
| download | emacs-2e0336939b4de5ada6f033ba02c42bf9a13e9dfc.tar.gz emacs-2e0336939b4de5ada6f033ba02c42bf9a13e9dfc.zip | |
(undo): Always set this-command to `undo',
so that the next undo after an error will not begin redoing.
(shell-command): Doc fix.
(shell-command-on-region): If there is output an an error,
add "...Shell command failed" to the output.
Diffstat (limited to 'lisp/simple.el')
| -rw-r--r-- | lisp/simple.el | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index cc358ae0edc..20d77114940 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -895,9 +895,13 @@ In Transient Mark mode when the mark is active, only undo changes within | |||
| 895 | the current region. Similarly, when not in Transient Mark mode, just C-u | 895 | the current region. Similarly, when not in Transient Mark mode, just C-u |
| 896 | as an argument limits undo to changes within the current region." | 896 | as an argument limits undo to changes within the current region." |
| 897 | (interactive "*P") | 897 | (interactive "*P") |
| 898 | ;; If we don't get all the way thru, make last-command indicate that | 898 | ;; Make last-command indicate for the next command that this was an undo. |
| 899 | ;; for the following command. | 899 | ;; That way, another undo will undo more. |
| 900 | (setq this-command t) | 900 | ;; If we get to the end of the undo history and get an error, |
| 901 | ;; another undo command will find the undo history empty | ||
| 902 | ;; and will get another error. To begin undoing the undos, | ||
| 903 | ;; you must type some other command. | ||
| 904 | (setq this-command 'undo) | ||
| 901 | (let ((modified (buffer-modified-p)) | 905 | (let ((modified (buffer-modified-p)) |
| 902 | (recent-save (recent-auto-save-p))) | 906 | (recent-save (recent-auto-save-p))) |
| 903 | (or (eq (selected-window) (minibuffer-window)) | 907 | (or (eq (selected-window) (minibuffer-window)) |
| @@ -934,9 +938,7 @@ as an argument limits undo to changes within the current region." | |||
| 934 | (setq prev tail tail (cdr tail)))) | 938 | (setq prev tail tail (cdr tail)))) |
| 935 | 939 | ||
| 936 | (and modified (not (buffer-modified-p)) | 940 | (and modified (not (buffer-modified-p)) |
| 937 | (delete-auto-save-file-if-necessary recent-save))) | 941 | (delete-auto-save-file-if-necessary recent-save)))) |
| 938 | ;; If we do get all the way thru, make this-command indicate that. | ||
| 939 | (setq this-command 'undo)) | ||
| 940 | 942 | ||
| 941 | (defvar pending-undo-list nil | 943 | (defvar pending-undo-list nil |
| 942 | "Within a run of consecutive undo commands, list remaining to be undone.") | 944 | "Within a run of consecutive undo commands, list remaining to be undone.") |
| @@ -1186,6 +1188,21 @@ If OUTPUT-BUFFER is not a buffer and not nil, | |||
| 1186 | insert output in current buffer. (This cannot be done asynchronously.) | 1188 | insert output in current buffer. (This cannot be done asynchronously.) |
| 1187 | In either case, the output is inserted after point (leaving mark after it). | 1189 | In either case, the output is inserted after point (leaving mark after it). |
| 1188 | 1190 | ||
| 1191 | If the command terminates without error, but generates output, | ||
| 1192 | and you did not specify \"insert it in the current buffer\", | ||
| 1193 | the output can be displayed in the echo area or in its buffer. | ||
| 1194 | If the output is short enough to display in the echo area | ||
| 1195 | \(determined by the variable `max-mini-window-height' if | ||
| 1196 | `resize-mini-windows' is non-nil), it is shown there. Otherwise, | ||
| 1197 | the buffer containing the output is displayed. | ||
| 1198 | |||
| 1199 | If there is output and an error, and you did not specify \"insert it | ||
| 1200 | in the current buffer\", a message about the error goes at the end | ||
| 1201 | of the output. | ||
| 1202 | |||
| 1203 | If there is no output, or if output is inserted in the current buffer, | ||
| 1204 | then `*Shell Command Output*' is deleted. | ||
| 1205 | |||
| 1189 | If the optional third argument ERROR-BUFFER is non-nil, it is a buffer | 1206 | If the optional third argument ERROR-BUFFER is non-nil, it is a buffer |
| 1190 | or buffer name to which to direct the command's standard error output. | 1207 | or buffer name to which to direct the command's standard error output. |
| 1191 | If it is nil, error output is mingled with regular output. | 1208 | If it is nil, error output is mingled with regular output. |
| @@ -1204,6 +1221,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1204 | (funcall handler 'shell-command command output-buffer error-buffer) | 1221 | (funcall handler 'shell-command command output-buffer error-buffer) |
| 1205 | (if (and output-buffer | 1222 | (if (and output-buffer |
| 1206 | (not (or (bufferp output-buffer) (stringp output-buffer)))) | 1223 | (not (or (bufferp output-buffer) (stringp output-buffer)))) |
| 1224 | ;; Output goes in current buffer. | ||
| 1207 | (let ((error-file | 1225 | (let ((error-file |
| 1208 | (if error-buffer | 1226 | (if error-buffer |
| 1209 | (make-temp-file | 1227 | (make-temp-file |
| @@ -1244,6 +1262,7 @@ specifies the value of ERROR-BUFFER." | |||
| 1244 | (goto-char (prog1 (mark t) | 1262 | (goto-char (prog1 (mark t) |
| 1245 | (set-marker (mark-marker) (point) | 1263 | (set-marker (mark-marker) (point) |
| 1246 | (current-buffer))))) | 1264 | (current-buffer))))) |
| 1265 | ;; Output goes in a separate buffer. | ||
| 1247 | ;; Preserve the match data in case called from a program. | 1266 | ;; Preserve the match data in case called from a program. |
| 1248 | (save-match-data | 1267 | (save-match-data |
| 1249 | (if (string-match "[ \t]*&[ \t]*$" command) | 1268 | (if (string-match "[ \t]*&[ \t]*$" command) |
| @@ -1368,13 +1387,19 @@ REPLACE, ERROR-BUFFER. Noninteractive callers can specify coding | |||
| 1368 | systems by binding `coding-system-for-read' and | 1387 | systems by binding `coding-system-for-read' and |
| 1369 | `coding-system-for-write'. | 1388 | `coding-system-for-write'. |
| 1370 | 1389 | ||
| 1371 | If the output is short enough to display in the echo area (which is | 1390 | If the command generates output, the output may be displayed |
| 1372 | determined by the variable `max-mini-window-height' if | 1391 | in the echo area or in a buffer. |
| 1373 | `resize-mini-windows' is non-nil), it is shown there, but it is | 1392 | If the output is short enough to display in the echo area |
| 1374 | nonetheless available in buffer `*Shell Command Output*' even though | 1393 | \(determined by the variable `max-mini-window-height' if |
| 1375 | that buffer is not automatically displayed. If there is no output, or | 1394 | `resize-mini-windows' is non-nil), it is shown there. Otherwise |
| 1376 | if output is inserted in the current buffer, then `*Shell Command | 1395 | it is displayed in the buffer `*Shell Command Output*'. The output |
| 1377 | Output*' is deleted. | 1396 | is available in that buffer in both cases. |
| 1397 | |||
| 1398 | If there is output and an error, a message about the error | ||
| 1399 | appears at the end of the output. | ||
| 1400 | |||
| 1401 | If there is no output, or if output is inserted in the current buffer, | ||
| 1402 | then `*Shell Command Output*' is deleted. | ||
| 1378 | 1403 | ||
| 1379 | If the optional fourth argument OUTPUT-BUFFER is non-nil, | 1404 | If the optional fourth argument OUTPUT-BUFFER is non-nil, |
| 1380 | that says to put the output in some other buffer. | 1405 | that says to put the output in some other buffer. |
| @@ -1471,10 +1496,16 @@ specifies the value of ERROR-BUFFER." | |||
| 1471 | buffer) | 1496 | buffer) |
| 1472 | nil shell-command-switch command))) | 1497 | nil shell-command-switch command))) |
| 1473 | (setq success (and exit-status (equal 0 exit-status))) | 1498 | (setq success (and exit-status (equal 0 exit-status))) |
| 1474 | ;; Report the amount of output. | 1499 | ;; Report the output. |
| 1475 | (if (with-current-buffer buffer (> (point-max) (point-min))) | 1500 | (if (with-current-buffer buffer (> (point-max) (point-min))) |
| 1476 | ;; There's some output, display it | 1501 | ;; There's some output, display it |
| 1477 | (display-message-or-buffer buffer) | 1502 | (progn |
| 1503 | (if (not success) | ||
| 1504 | (with-current-buffer buffer | ||
| 1505 | (save-excursion | ||
| 1506 | (goto-char (point-max)) | ||
| 1507 | (insert "...Shell command failed")))) | ||
| 1508 | (display-message-or-buffer buffer)) | ||
| 1478 | ;; No output; error? | 1509 | ;; No output; error? |
| 1479 | (message (if (and error-file | 1510 | (message (if (and error-file |
| 1480 | (< 0 (nth 7 (file-attributes error-file)))) | 1511 | (< 0 (nth 7 (file-attributes error-file)))) |