From 4ffb2ec357a75867a123b3571d622be184945dc5 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 28 Dec 2020 02:03:56 +0100 Subject: Allow remember-notes to use the *scratch* buffer * lisp/textmodes/remember.el (remember-notes): Allow the remember-notes buffer to use the *scratch* buffer (as documented) (bug#20740). --- lisp/textmodes/remember.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el index 7bc7dc1762e..599e8f69ba7 100644 --- a/lisp/textmodes/remember.el +++ b/lisp/textmodes/remember.el @@ -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) -- cgit v1.2.1