895 |
the current region. Similarly, when not in Transient Mark mode, just C-u |
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." |
as an argument limits undo to changes within the current region." |
897 |
(interactive "*P") |
(interactive "*P") |
898 |
;; If we don't get all the way thru, make last-command indicate that |
;; Make last-command indicate for the next command that this was an undo. |
899 |
;; for the following command. |
;; That way, another undo will undo more. |
900 |
(setq this-command t) |
;; 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) |
905 |
(let ((modified (buffer-modified-p)) |
(let ((modified (buffer-modified-p)) |
906 |
(recent-save (recent-auto-save-p))) |
(recent-save (recent-auto-save-p))) |
907 |
(or (eq (selected-window) (minibuffer-window)) |
(or (eq (selected-window) (minibuffer-window)) |
938 |
(setq prev tail tail (cdr tail)))) |
(setq prev tail tail (cdr tail)))) |
939 |
|
|
940 |
(and modified (not (buffer-modified-p)) |
(and modified (not (buffer-modified-p)) |
941 |
(delete-auto-save-file-if-necessary recent-save))) |
(delete-auto-save-file-if-necessary recent-save)))) |
|
;; If we do get all the way thru, make this-command indicate that. |
|
|
(setq this-command 'undo)) |
|
942 |
|
|
943 |
(defvar pending-undo-list nil |
(defvar pending-undo-list nil |
944 |
"Within a run of consecutive undo commands, list remaining to be undone.") |
"Within a run of consecutive undo commands, list remaining to be undone.") |
1188 |
insert output in current buffer. (This cannot be done asynchronously.) |
insert output in current buffer. (This cannot be done asynchronously.) |
1189 |
In either case, the output is inserted after point (leaving mark after it). |
In either case, the output is inserted after point (leaving mark after it). |
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 |
|
|
1206 |
If the optional third argument ERROR-BUFFER is non-nil, it is a buffer |
If the optional third argument ERROR-BUFFER is non-nil, it is a buffer |
1207 |
or buffer name to which to direct the command's standard error output. |
or buffer name to which to direct the command's standard error output. |
1208 |
If it is nil, error output is mingled with regular output. |
If it is nil, error output is mingled with regular output. |
1221 |
(funcall handler 'shell-command command output-buffer error-buffer) |
(funcall handler 'shell-command command output-buffer error-buffer) |
1222 |
(if (and output-buffer |
(if (and output-buffer |
1223 |
(not (or (bufferp output-buffer) (stringp output-buffer)))) |
(not (or (bufferp output-buffer) (stringp output-buffer)))) |
1224 |
|
;; Output goes in current buffer. |
1225 |
(let ((error-file |
(let ((error-file |
1226 |
(if error-buffer |
(if error-buffer |
1227 |
(make-temp-file |
(make-temp-file |
1262 |
(goto-char (prog1 (mark t) |
(goto-char (prog1 (mark t) |
1263 |
(set-marker (mark-marker) (point) |
(set-marker (mark-marker) (point) |
1264 |
(current-buffer))))) |
(current-buffer))))) |
1265 |
|
;; Output goes in a separate buffer. |
1266 |
;; Preserve the match data in case called from a program. |
;; Preserve the match data in case called from a program. |
1267 |
(save-match-data |
(save-match-data |
1268 |
(if (string-match "[ \t]*&[ \t]*$" command) |
(if (string-match "[ \t]*&[ \t]*$" command) |
1387 |
systems by binding `coding-system-for-read' and |
systems by binding `coding-system-for-read' and |
1388 |
`coding-system-for-write'. |
`coding-system-for-write'. |
1389 |
|
|
1390 |
If the output is short enough to display in the echo area (which is |
If the command generates output, the output may be displayed |
1391 |
determined by the variable `max-mini-window-height' if |
in the echo area or in a buffer. |
1392 |
`resize-mini-windows' is non-nil), it is shown there, but it is |
If the output is short enough to display in the echo area |
1393 |
nonetheless available in buffer `*Shell Command Output*' even though |
\(determined by the variable `max-mini-window-height' if |
1394 |
that buffer is not automatically displayed. If there is no output, or |
`resize-mini-windows' is non-nil), it is shown there. Otherwise |
1395 |
if output is inserted in the current buffer, then `*Shell Command |
it is displayed in the buffer `*Shell Command Output*'. The output |
1396 |
Output*' is deleted. |
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. |
1403 |
|
|
1404 |
If the optional fourth argument OUTPUT-BUFFER is non-nil, |
If the optional fourth argument OUTPUT-BUFFER is non-nil, |
1405 |
that says to put the output in some other buffer. |
that says to put the output in some other buffer. |
1496 |
buffer) |
buffer) |
1497 |
nil shell-command-switch command))) |
nil shell-command-switch command))) |
1498 |
(setq success (and exit-status (equal 0 exit-status))) |
(setq success (and exit-status (equal 0 exit-status))) |
1499 |
;; Report the amount of output. |
;; Report the output. |
1500 |
(if (with-current-buffer buffer (> (point-max) (point-min))) |
(if (with-current-buffer buffer (> (point-max) (point-min))) |
1501 |
;; There's some output, display it |
;; There's some output, display it |
1502 |
(display-message-or-buffer buffer) |
(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)) |
1509 |
;; No output; error? |
;; No output; error? |
1510 |
(message (if (and error-file |
(message (if (and error-file |
1511 |
(< 0 (nth 7 (file-attributes error-file)))) |
(< 0 (nth 7 (file-attributes error-file)))) |