]> git.eshelyaron.com Git - emacs.git/commitdiff
Make newly-created smerge-diff-buffers read-only
authorSpencer Baugh <sbaugh@janestreet.com>
Wed, 28 Jun 2023 12:48:01 +0000 (08:48 -0400)
committerEli Zaretskii <eliz@gnu.org>
Thu, 5 Oct 2023 08:04:47 +0000 (11:04 +0300)
Buffers name *vc-diff* are usually created by vc, which makes them
read-only.  If we create such a buffer, let's make it read-only too.
If the buffer already exists, though, don't change that since the user
might have deliberately made it writable.

* lisp/vc/smerge-mode.el (smerge-diff): Make newly-created
smerge-diff-buffers read-only. (bug#64071)

lisp/vc/smerge-mode.el

index 7847a6c7670fb7ff1be3b1e5a2232f2021724ac2..e42b82c7064c0f6fcc82febdd62d761a646fbd1e 100644 (file)
@@ -1239,7 +1239,11 @@ spacing of the \"Lower\" chunk."
     (write-region beg1 end1 file1 nil 'nomessage)
     (write-region beg2 end2 file2 nil 'nomessage)
     (unwind-protect
-       (with-current-buffer (get-buffer-create smerge-diff-buffer-name)
+       (save-current-buffer
+          (if-let (buffer (get-buffer smerge-diff-buffer-name))
+              (set-buffer buffer)
+            (set-buffer (get-buffer-create smerge-diff-buffer-name))
+            (setq buffer-read-only t))
          (setq default-directory dir)
          (let ((inhibit-read-only t))
            (erase-buffer)