emacs: use defvar-local

It is available since Emacs 24.3 and we require at least Emacs 25.
This commit is contained in:
Jonas Bernoulli 2020-11-16 22:28:38 +01:00 committed by David Bremner
parent dff7f06711
commit 9fadab4e63
6 changed files with 21 additions and 43 deletions

View file

@ -50,9 +50,7 @@ Otherwise respect `fill-column'."
:group 'coolj :group 'coolj
:type 'regexp) :type 'regexp)
(defvar coolj-wrap-point nil) (defvar-local coolj-wrap-point nil)
(make-variable-buffer-local 'coolj-wrap-point)
(defun coolj-determine-prefix () (defun coolj-determine-prefix ()
"Determine the prefix for the current line." "Determine the prefix for the current line."

View file

@ -36,8 +36,8 @@
(require 'notmuch-lib) (require 'notmuch-lib)
(defvar notmuch-company-last-prefix nil) (defvar-local notmuch-company-last-prefix nil)
(make-variable-buffer-local 'notmuch-company-last-prefix)
(declare-function company-begin-backend "company") (declare-function company-begin-backend "company")
(declare-function company-grab "company") (declare-function company-grab "company")
(declare-function company-mode "company") (declare-function company-mode "company")

View file

@ -89,9 +89,8 @@ like they are intended to be sent encrypted
"<#\\(part encrypt\\|secure.*mode=.*encrypt>\\)" "<#\\(part encrypt\\|secure.*mode=.*encrypt>\\)"
"Regular expression matching mml tags indicating encryption of part or message.") "Regular expression matching mml tags indicating encryption of part or message.")
(defvar notmuch-draft-id nil (defvar-local notmuch-draft-id nil
"Message-id of the most recent saved draft of this message.") "Message-id of the most recent saved draft of this message.")
(make-variable-buffer-local 'notmuch-draft-id)
(defun notmuch-draft--mark-deleted () (defun notmuch-draft--mark-deleted ()
"Tag the last saved draft deleted. "Tag the last saved draft deleted.

View file

@ -435,9 +435,8 @@ of its command symbol."
(insert desc))) (insert desc)))
(pop-to-buffer (help-buffer))))) (pop-to-buffer (help-buffer)))))
(defvar notmuch-buffer-refresh-function nil (defvar-local notmuch-buffer-refresh-function nil
"Function to call to refresh the current buffer.") "Function to call to refresh the current buffer.")
(make-variable-buffer-local 'notmuch-buffer-refresh-function)
(defun notmuch-refresh-this-buffer () (defun notmuch-refresh-this-buffer ()
"Refresh the current buffer." "Refresh the current buffer."
@ -989,10 +988,7 @@ status."
(find-file-noselect err-file)))) (find-file-noselect err-file))))
(when err-buffer (kill-buffer err-buffer)))) (when err-buffer (kill-buffer err-buffer))))
;; This variable is used only buffer local, but it needs to be (defvar-local notmuch-show-process-crypto nil)
;; declared globally first to avoid compiler warnings.
(defvar notmuch-show-process-crypto nil)
(make-variable-buffer-local 'notmuch-show-process-crypto)
(defun notmuch-interactive-region () (defun notmuch-interactive-region ()
"Return the bounds of the current interactive region. "Return the bounds of the current interactive region.

View file

@ -162,23 +162,17 @@ indentation."
:type '(choice (const nil) regexp) :type '(choice (const nil) regexp)
:group 'notmuch-show) :group 'notmuch-show)
(defvar notmuch-show-thread-id nil) (defvar-local notmuch-show-thread-id nil)
(make-variable-buffer-local 'notmuch-show-thread-id)
(defvar notmuch-show-parent-buffer nil) (defvar-local notmuch-show-parent-buffer nil)
(make-variable-buffer-local 'notmuch-show-parent-buffer)
(defvar notmuch-show-query-context nil) (defvar-local notmuch-show-query-context nil)
(make-variable-buffer-local 'notmuch-show-query-context)
(defvar notmuch-show-process-crypto nil) (defvar-local notmuch-show-process-crypto nil)
(make-variable-buffer-local 'notmuch-show-process-crypto)
(defvar notmuch-show-elide-non-matching-messages nil) (defvar-local notmuch-show-elide-non-matching-messages nil)
(make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
(defvar notmuch-show-indent-content t) (defvar-local notmuch-show-indent-content t)
(make-variable-buffer-local 'notmuch-show-indent-content)
(defvar notmuch-show-attachment-debug nil (defvar notmuch-show-attachment-debug nil
"If t log stdout and stderr from attachment handlers. "If t log stdout and stderr from attachment handlers.

View file

@ -51,9 +51,8 @@
(defvar notmuch-search-query-string) (defvar notmuch-search-query-string)
;; this variable distinguishes the unthreaded display from the normal tree display ;; this variable distinguishes the unthreaded display from the normal tree display
(defvar notmuch-tree-unthreaded nil (defvar-local notmuch-tree-unthreaded nil
"A buffer local copy of argument unthreaded to the function notmuch-tree.") "A buffer local copy of argument unthreaded to the function notmuch-tree.")
(make-variable-buffer-local 'notmuch-tree-unthreaded)
(defgroup notmuch-tree nil (defgroup notmuch-tree nil
"Showing message and thread structure." "Showing message and thread structure."
@ -207,44 +206,36 @@ For example:
:group 'notmuch-tree :group 'notmuch-tree
:group 'notmuch-faces) :group 'notmuch-faces)
(defvar notmuch-tree-previous-subject (defvar-local notmuch-tree-previous-subject
"The subject of the most recent result shown during the async display.") "The subject of the most recent result shown during the async display.")
(make-variable-buffer-local 'notmuch-tree-previous-subject)
(defvar notmuch-tree-basic-query nil (defvar-local notmuch-tree-basic-query nil
"A buffer local copy of argument query to the function notmuch-tree.") "A buffer local copy of argument query to the function notmuch-tree.")
(make-variable-buffer-local 'notmuch-tree-basic-query)
(defvar notmuch-tree-query-context nil (defvar-local notmuch-tree-query-context nil
"A buffer local copy of argument query-context to the function notmuch-tree.") "A buffer local copy of argument query-context to the function notmuch-tree.")
(make-variable-buffer-local 'notmuch-tree-query-context)
(defvar notmuch-tree-target-msg nil (defvar-local notmuch-tree-target-msg nil
"A buffer local copy of argument target to the function notmuch-tree.") "A buffer local copy of argument target to the function notmuch-tree.")
(make-variable-buffer-local 'notmuch-tree-target-msg)
(defvar notmuch-tree-open-target nil (defvar-local notmuch-tree-open-target nil
"A buffer local copy of argument open-target to the function notmuch-tree.") "A buffer local copy of argument open-target to the function notmuch-tree.")
(make-variable-buffer-local 'notmuch-tree-open-target)
(defvar notmuch-tree-parent-buffer nil) (defvar-local notmuch-tree-parent-buffer nil)
(make-variable-buffer-local 'notmuch-tree-parent-buffer)
(defvar notmuch-tree-message-window nil (defvar-local notmuch-tree-message-window nil
"The window of the message pane. "The window of the message pane.
It is set in both the tree buffer and the child show buffer. It It is set in both the tree buffer and the child show buffer. It
is used to try and close the message pane when quitting tree view is used to try and close the message pane when quitting tree view
or the child show buffer.") or the child show buffer.")
(make-variable-buffer-local 'notmuch-tree-message-window)
(put 'notmuch-tree-message-window 'permanent-local t) (put 'notmuch-tree-message-window 'permanent-local t)
(defvar notmuch-tree-message-buffer nil (defvar-local notmuch-tree-message-buffer nil
"The buffer name of the show buffer in the message pane. "The buffer name of the show buffer in the message pane.
This is used to try and make sure we don't close the message pane This is used to try and make sure we don't close the message pane
if the user has loaded a different buffer in that window.") if the user has loaded a different buffer in that window.")
(make-variable-buffer-local 'notmuch-tree-message-buffer)
(put 'notmuch-tree-message-buffer 'permanent-local t) (put 'notmuch-tree-message-buffer 'permanent-local t)
(defun notmuch-tree-to-message-pane (func) (defun notmuch-tree-to-message-pane (func)