]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix problem with `format-alist' marking all the text in the buffer
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 1 Jun 2021 08:22:57 +0000 (10:22 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 1 Jun 2021 08:22:57 +0000 (10:22 +0200)
* 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
lisp/simple.el

index 3e2d92fef130e915bbf62222d6f8e52bbe092c08..1e87d252844fb52a5cf70a45bcaf980549acbf63 100644 (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
index 884991936025b2b64d69367d4b25089fa2ed66fc..cdd77f74c3e3c9ab6d69a83cb77632dd76c53f00 100644 (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