]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow remember-notes to use the *scratch* buffer
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 28 Dec 2020 01:03:56 +0000 (02:03 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 28 Dec 2020 01:04:05 +0000 (02:04 +0100)
* lisp/textmodes/remember.el (remember-notes): Allow the
remember-notes buffer to use the *scratch* buffer (as documented)
(bug#20740).

lisp/textmodes/remember.el

index 7bc7dc1762e959e85a6879124c019b3c4ea02aba..599e8f69ba72ed2565868558ccc3cd369963e81a 100644 (file)
@@ -638,9 +638,14 @@ to turn the *scratch* buffer into your notes buffer."
   (interactive "p")
   (let ((buf (or (find-buffer-visiting remember-data-file)
                  (with-current-buffer (find-file-noselect remember-data-file)
-                   (and remember-notes-buffer-name
-                        (not (get-buffer remember-notes-buffer-name))
-                        (rename-buffer remember-notes-buffer-name))
+                   (when remember-notes-buffer-name
+                     (when (and (get-buffer remember-notes-buffer-name)
+                                (equal remember-notes-buffer-name "*scratch*"))
+                       (kill-buffer remember-notes-buffer-name))
+                     ;; Rename the buffer to the requested name (if
+                     ;; it's not already in use).
+                     (unless (get-buffer remember-notes-buffer-name)
+                       (rename-buffer remember-notes-buffer-name)))
                    (funcall (or remember-notes-initial-major-mode
                                 initial-major-mode))
                    (remember-notes-mode 1)