]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: define a few variables as automatically buffer-local
authorJonas Bernoulli <jonas@bernoul.li>
Sun, 10 Jan 2021 14:01:03 +0000 (15:01 +0100)
committerDavid Bremner <david@tethera.net>
Fri, 15 Jan 2021 10:44:01 +0000 (06:44 -0400)
Define these variables as automatically buffer-local, meaning that
they always become buffer-local when set unless explicitly told
otherwise using `setq-default' or when using the Custom interface.

Previously they were declared, which keeps the byte-compiler quiet but
is not actually the same as being defined.  `notmuch-search-mode' then
made them buffer-local in the current buffer and then set the local
values.  This works but is not kosher.

The definitions of the three non-option variables have to be moved up
a bit to enable the change in the next commit, which see.

emacs/notmuch-lib.el
emacs/notmuch.el

index 72549a986f61e884a2e5adb35aa187d2887d21af..2fd9a27de8a352385fc00a3564d6d72645618016 100644 (file)
@@ -101,6 +101,7 @@ search results. Note that any filtered searches created by
 search."
   :type 'boolean
   :group 'notmuch-search)
+(make-variable-buffer-local 'notmuch-search-oldest-first)
 
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
index ccece8118831b722fc28d8b9346ed6c93db35232..027c5cfad7c404fe1a5ef783fd224ff5c338f561 100644 (file)
@@ -205,6 +205,12 @@ there will be called at other points of notmuch execution."
     map)
   "Keymap for \"notmuch search\" buffers.")
 
+;;; Internal Variables
+
+(defvar-local notmuch-search-query-string nil)
+(defvar-local notmuch-search-target-thread nil)
+(defvar-local notmuch-search-target-line nil)
+
 ;;; Stashing
 
 (defvar notmuch-search-stash-map
@@ -226,12 +232,6 @@ there will be called at other points of notmuch execution."
   (interactive)
   (notmuch-common-do-stash (notmuch-search-get-query)))
 
-;;; Variables
-
-(defvar notmuch-search-query-string)
-(defvar notmuch-search-target-thread)
-(defvar notmuch-search-target-line)
-
 ;;; Movement
 
 (defun notmuch-search-scroll-up ()
@@ -404,10 +404,6 @@ new, global search.
 Complete list of currently available key bindings:
 
 \\{notmuch-search-mode-map}"
-  (make-local-variable 'notmuch-search-query-string)
-  (make-local-variable 'notmuch-search-oldest-first)
-  (make-local-variable 'notmuch-search-target-thread)
-  (make-local-variable 'notmuch-search-target-line)
   (setq notmuch-buffer-refresh-function #'notmuch-search-refresh-view)
   (setq-local scroll-preserve-screen-position t)
   (add-to-invisibility-spec (cons 'ellipsis t))