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)
(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)