1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-04 22:50:59 -08:00

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.
This commit is contained in:
Lars Ingebrigtsen 2021-06-01 10:22:57 +02:00
parent 43a9c3f725
commit d9ccc3fa2a
2 changed files with 8 additions and 4 deletions

View file

@ -181,7 +181,7 @@ it should be a Lisp function. BUFFER is currently ignored."
;; We should perhaps go via a temporary buffer and copy it
;; back, in case of errors.
(if (and (zerop (save-window-excursion
(shell-command-on-region from to method t t
(shell-command-on-region from to method t 'no-mark
error-buff)))
;; gzip gives zero exit status with bad args, for instance.
(zerop (with-current-buffer error-buff

View file

@ -4334,7 +4334,7 @@ current buffer after START.
Optional fifth arg REPLACE, if non-nil, means to insert the
output in place of text from START to END, putting point and mark
around it.
around it. If REPLACE is the symbol `no-mark', don't set the mark.
Optional sixth arg ERROR-BUFFER, if non-nil, specifies a buffer
or buffer name to which to direct the command's standard error
@ -4409,7 +4409,9 @@ characters."
(let ((swap (and replace (< start end))))
;; Don't muck with mark unless REPLACE says we should.
(goto-char start)
(and replace (push-mark (point) 'nomsg))
(when (and replace
(not (eq replace 'no-mark)))
(push-mark (point) 'nomsg))
(setq exit-status
(call-shell-region start end command replace
(if error-file
@ -4420,7 +4422,9 @@ characters."
;; (and shell-buffer (not (eq shell-buffer (current-buffer)))
;; (kill-buffer shell-buffer)))
;; Don't muck with mark unless REPLACE says we should.
(and replace swap (exchange-point-and-mark)))
(when (and replace swap
(not (eq replace 'no-mark)))
(exchange-point-and-mark)))
;; No prefix argument: put the output in a temp buffer,
;; replacing its entire contents.
(let ((buffer (get-buffer-create