From: Lars Ingebrigtsen Date: Tue, 1 Jun 2021 08:22:57 +0000 (+0200) Subject: Fix problem with `format-alist' marking all the text in the buffer X-Git-Tag: emacs-28.0.90~2236 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d9ccc3fa2ac0ce1bd522ddc26070edfac55c69a7;p=emacs.git 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. --- 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." ;; 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 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. 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