diff options
| author | Lars Ingebrigtsen | 2021-06-01 10:22:57 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-06-01 10:22:57 +0200 |
| commit | d9ccc3fa2ac0ce1bd522ddc26070edfac55c69a7 (patch) | |
| tree | c5d6bd59b3d9a6471dba6ecda8794c3fb1cbccb9 /lisp | |
| parent | 43a9c3f725967001cfbcb9e85525f035d628bf36 (diff) | |
| download | emacs-d9ccc3fa2ac0ce1bd522ddc26070edfac55c69a7.tar.gz emacs-d9ccc3fa2ac0ce1bd522ddc26070edfac55c69a7.zip | |
Fix problem with `format-alist' marking all the text in the buffer
* lisp/format.el (format-decode-run-method): Use it to avoid
marking the entire buffer (bug#11691).
* lisp/simple.el (shell-command-on-region): Allow replacing text
without activating the mark.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/format.el | 2 | ||||
| -rw-r--r-- | lisp/simple.el | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lisp/format.el b/lisp/format.el index 3e2d92fef13..1e87d252844 100644 --- a/lisp/format.el +++ b/lisp/format.el | |||
| @@ -181,7 +181,7 @@ it should be a Lisp function. BUFFER is currently ignored." | |||
| 181 | ;; We should perhaps go via a temporary buffer and copy it | 181 | ;; We should perhaps go via a temporary buffer and copy it |
| 182 | ;; back, in case of errors. | 182 | ;; back, in case of errors. |
| 183 | (if (and (zerop (save-window-excursion | 183 | (if (and (zerop (save-window-excursion |
| 184 | (shell-command-on-region from to method t t | 184 | (shell-command-on-region from to method t 'no-mark |
| 185 | error-buff))) | 185 | error-buff))) |
| 186 | ;; gzip gives zero exit status with bad args, for instance. | 186 | ;; gzip gives zero exit status with bad args, for instance. |
| 187 | (zerop (with-current-buffer error-buff | 187 | (zerop (with-current-buffer error-buff |
diff --git a/lisp/simple.el b/lisp/simple.el index 88499193602..cdd77f74c3e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4334,7 +4334,7 @@ current buffer after START. | |||
| 4334 | 4334 | ||
| 4335 | Optional fifth arg REPLACE, if non-nil, means to insert the | 4335 | Optional fifth arg REPLACE, if non-nil, means to insert the |
| 4336 | output in place of text from START to END, putting point and mark | 4336 | output in place of text from START to END, putting point and mark |
| 4337 | around it. | 4337 | around it. If REPLACE is the symbol `no-mark', don't set the mark. |
| 4338 | 4338 | ||
| 4339 | Optional sixth arg ERROR-BUFFER, if non-nil, specifies a buffer | 4339 | Optional sixth arg ERROR-BUFFER, if non-nil, specifies a buffer |
| 4340 | or buffer name to which to direct the command's standard error | 4340 | or buffer name to which to direct the command's standard error |
| @@ -4409,7 +4409,9 @@ characters." | |||
| 4409 | (let ((swap (and replace (< start end)))) | 4409 | (let ((swap (and replace (< start end)))) |
| 4410 | ;; Don't muck with mark unless REPLACE says we should. | 4410 | ;; Don't muck with mark unless REPLACE says we should. |
| 4411 | (goto-char start) | 4411 | (goto-char start) |
| 4412 | (and replace (push-mark (point) 'nomsg)) | 4412 | (when (and replace |
| 4413 | (not (eq replace 'no-mark))) | ||
| 4414 | (push-mark (point) 'nomsg)) | ||
| 4413 | (setq exit-status | 4415 | (setq exit-status |
| 4414 | (call-shell-region start end command replace | 4416 | (call-shell-region start end command replace |
| 4415 | (if error-file | 4417 | (if error-file |
| @@ -4420,7 +4422,9 @@ characters." | |||
| 4420 | ;; (and shell-buffer (not (eq shell-buffer (current-buffer))) | 4422 | ;; (and shell-buffer (not (eq shell-buffer (current-buffer))) |
| 4421 | ;; (kill-buffer shell-buffer))) | 4423 | ;; (kill-buffer shell-buffer))) |
| 4422 | ;; Don't muck with mark unless REPLACE says we should. | 4424 | ;; Don't muck with mark unless REPLACE says we should. |
| 4423 | (and replace swap (exchange-point-and-mark))) | 4425 | (when (and replace swap |
| 4426 | (not (eq replace 'no-mark))) | ||
| 4427 | (exchange-point-and-mark))) | ||
| 4424 | ;; No prefix argument: put the output in a temp buffer, | 4428 | ;; No prefix argument: put the output in a temp buffer, |
| 4425 | ;; replacing its entire contents. | 4429 | ;; replacing its entire contents. |
| 4426 | (let ((buffer (get-buffer-create | 4430 | (let ((buffer (get-buffer-create |