emacs-diffs
[Top][All Lists]
Advanced

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

emacs-30 794bb2a2e31: remember-data-file: Don't unconditionally call set


From: Sean Whitton
Subject: emacs-30 794bb2a2e31: remember-data-file: Don't unconditionally call set-visited-file-name
Date: Wed, 25 Sep 2024 11:03:21 -0400 (EDT)

branch: emacs-30
commit 794bb2a2e31f3027e1db9e027af28151f11a32ed
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>

    remember-data-file: Don't unconditionally call set-visited-file-name
    
    * lisp/textmodes/remember.el (remember-data-file): Don't
    unconditionally call set-visited-file-name.
---
 lisp/textmodes/remember.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index c75a9b758e7..cc3496da33c 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -378,8 +378,15 @@ exists) might be changed."
            (set-default symbol value)
            (when (buffer-live-p buf)
              (with-current-buffer buf
-               (set-visited-file-name
-                (expand-file-name remember-data-file))))))
+               ;; Don't unconditionally call `set-visited-file-name'
+               ;; because that will probably change the major mode and
+               ;; rename the buffer.
+               ;; These must be avoided in the case where
+               ;; `remember-notes-buffer-name' is "*scratch*", a
+               ;; supported configuration.
+               (let ((value (expand-file-name value)))
+                 (unless (string= buffer-file-name value)
+                   (set-visited-file-name value)))))))
   :initialize #'custom-initialize-default)
 
 (defcustom remember-leader-text "** "



reply via email to

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