emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d9ccc3f 4/4: Fix problem with `format-alist' marking all the text


From: Lars Ingebrigtsen
Subject: master d9ccc3f 4/4: Fix problem with `format-alist' marking all the text in the buffer
Date: Tue, 1 Jun 2021 04:24:41 -0400 (EDT)

branch: master
commit d9ccc3fa2ac0ce1bd522ddc26070edfac55c69a7
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/format.el |  2 +-
 lisp/simple.el | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/format.el b/lisp/format.el
index 3e2d92f..1e87d25 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 8849919..cdd77f7 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]