1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Prefer defvar-local where possible

* lisp/editorconfig.el (editorconfig-properties-hash):
* lisp/emacs-lisp/comp-run.el (comp-last-scanned-async-output):
* lisp/info-look.el (info-lookup-mode):
* lisp/mh-e/mh-folder.el (mh-generate-sequence-font-lock):
* lisp/net/tramp.el (tramp-temp-buffer-file-name):
* lisp/obsolete/iswitchb.el (iswitchb-eoinput):
* lisp/obsolete/longlines.el (longlines-wrap-beg, longlines-wrap-end)
(longlines-wrap-point, longlines-showing, longlines-decoded):
* lisp/obsolete/tpu-edt.el (tpu-newline-and-indent-p)
(tpu-newline-and-indent-string, tpu-saved-delete-func)
(tpu-buffer-local-map, tpu-mark-flag):
* lisp/progmodes/python.el (python-check-custom-command):
* lisp/textmodes/reftex.el (reftex-docstruct-symbol)
(reftex-isearch-minor-mode): Prefer defvar-local where possible, and
the package does not support Emacs 24.3 or earlier.
This commit is contained in:
Stefan Kangas 2024-10-01 20:22:34 +02:00
parent ff87166227
commit e792856b00
10 changed files with 21 additions and 47 deletions

View File

@ -283,14 +283,11 @@ If set, enable that mode when `trim_trailing_whitespace` is set to true.
Otherwise, use `delete-trailing-whitespace'."
:type 'symbol)
(defvar editorconfig-properties-hash nil
(defvar-local editorconfig-properties-hash nil
"Hash object of EditorConfig properties that was enabled for current buffer.
Set by `editorconfig-apply' and nil if that is not invoked in
current buffer yet.")
(make-variable-buffer-local 'editorconfig-properties-hash)
(put 'editorconfig-properties-hash
'permanent-local
t)
(put 'editorconfig-properties-hash 'permanent-local t)
(defvar editorconfig-lisp-use-default-indent nil
"Selectively ignore the value of indent_size for Lisp files.
@ -464,9 +461,7 @@ heuristic for those modes not found there."
(defvar-local editorconfig--apply-coding-system-currently nil
"Used internally.")
(put 'editorconfig--apply-coding-system-currently
'permanent-local
t)
(put 'editorconfig--apply-coding-system-currently 'permanent-local t)
(defun editorconfig-merge-coding-systems (end-of-line charset)
"Return merged coding system symbol of END-OF-LINE and CHARSET."

View File

@ -186,8 +186,7 @@ processes from `comp-async-compilations'"
(max 1 (/ (num-processors) 2))))
native-comp-async-jobs-number))
(defvar comp-last-scanned-async-output nil)
(make-variable-buffer-local 'comp-last-scanned-async-output)
(defvar-local comp-last-scanned-async-output nil)
;; From warnings.el
(defvar warning-suppress-types)
(defun comp--accept-and-process-async-output (process)

View File

@ -46,11 +46,10 @@
"Major mode sensitive help agent."
:group 'help :group 'languages)
(defvar info-lookup-mode nil
(defvar-local info-lookup-mode nil
"Symbol of the current buffer's help mode.
Help is provided according to the buffer's major mode if value is nil.
Automatically becomes buffer local when set in any fashion.")
(make-variable-buffer-local 'info-lookup-mode)
(defcustom info-lookup-other-window-flag t
"Non-nil means pop up the Info buffer in another window."

View File

@ -454,11 +454,10 @@ FACE is the font-lock face used to display the matching scan lines."
(let ((cache (intern (format "mh-folder-%s-seq-cache" prefix)))
(func (intern (format "mh-folder-font-lock-%s" prefix))))
`(progn
(defvar ,cache nil
(defvar-local ,cache nil
"Internal cache variable used for font-lock in MH-E.
Should only be non-nil through font-lock stepping, and nil once
font-lock is done highlighting.")
(make-variable-buffer-local ',cache)
(defun ,func (limit)
"Return unseen message lines to font-lock between point and LIMIT."

View File

@ -853,11 +853,9 @@ filename part, though.")
"Buffer name for a temporary buffer.
It shall be used in combination with `generate-new-buffer-name'.")
(defvar tramp-temp-buffer-file-name nil
(defvar-local tramp-temp-buffer-file-name nil
"File name of a persistent local temporary file.
Useful for \"rsync\" like methods.")
(make-variable-buffer-local 'tramp-temp-buffer-file-name)
(put 'tramp-temp-buffer-file-name 'permanent-local t)
(defcustom tramp-syntax 'default

View File

@ -410,10 +410,9 @@ Its value is one of `samewindow', `otherwindow', `display', `otherframe',
`maybe-frame' or `always-frame'. See `iswitchb-default-method' for
details of values.")
(defvar iswitchb-eoinput 1
(defvar-local iswitchb-eoinput 1
"Point where minibuffer input ends and completion info begins.
Copied from `icomplete-eoinput'.")
(make-variable-buffer-local 'iswitchb-eoinput)
(defvar iswitchb-buflist nil
"Stores the current list of buffers that will be searched through.

View File

@ -80,17 +80,11 @@ This is used when `longlines-show-hard-newlines' is on."
;;; Internal variables
(defvar longlines-wrap-beg nil)
(defvar longlines-wrap-end nil)
(defvar longlines-wrap-point nil)
(defvar longlines-showing nil)
(defvar longlines-decoded nil)
(make-variable-buffer-local 'longlines-wrap-beg)
(make-variable-buffer-local 'longlines-wrap-end)
(make-variable-buffer-local 'longlines-wrap-point)
(make-variable-buffer-local 'longlines-showing)
(make-variable-buffer-local 'longlines-decoded)
(defvar-local longlines-wrap-beg nil)
(defvar-local longlines-wrap-end nil)
(defvar-local longlines-wrap-point nil)
(defvar-local longlines-showing nil)
(defvar-local longlines-decoded nil)
;;; Mode

View File

@ -604,21 +604,17 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.")
;;;
;;; Buffer Local Variables
;;;
(defvar tpu-newline-and-indent-p nil
(defvar-local tpu-newline-and-indent-p nil
"If non-nil, Return produces a newline and indents.")
(make-variable-buffer-local 'tpu-newline-and-indent-p)
(defvar tpu-newline-and-indent-string nil
(defvar-local tpu-newline-and-indent-string nil
"Mode line string to identify AutoIndent mode.")
(make-variable-buffer-local 'tpu-newline-and-indent-string)
(defvar tpu-saved-delete-func nil
(defvar-local tpu-saved-delete-func nil
"Saved value of the delete key.")
(make-variable-buffer-local 'tpu-saved-delete-func)
(defvar tpu-buffer-local-map nil
(defvar-local tpu-buffer-local-map nil
"TPU-edt buffer local key map.")
(make-variable-buffer-local 'tpu-buffer-local-map)
;;;
@ -631,8 +627,7 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.")
;;;
(defvar tpu-original-mm-alist minor-mode-alist)
(defvar tpu-mark-flag "")
(make-variable-buffer-local 'tpu-mark-flag)
(defvar-local tpu-mark-flag "")
(defun tpu-set-mode-line (for-tpu)
"Set `minor-mode-alist' for TPU-edt, or reset it to default Emacs."

View File

@ -5574,10 +5574,8 @@ def __FFAP_get_module_path(objstr):
"Buffer name used for check commands."
:type 'string)
(defvar python-check-custom-command nil
(defvar-local python-check-custom-command nil
"Internal use.")
;; XXX: Avoid `defvar-local' for compat with Emacs<24.3
(make-variable-buffer-local 'python-check-custom-command)
(defun python-check (command)
"Check a Python file (default current buffer's file).

View File

@ -273,8 +273,7 @@ on the menu bar.
(defvar reftex-multifile-index 0)
;; Variable holding the symbol with the label list of the document.
(defvar reftex-docstruct-symbol nil)
(make-variable-buffer-local 'reftex-docstruct-symbol)
(defvar-local reftex-docstruct-symbol nil)
(defun reftex-next-multifile-index ()
;; Return the next free index for multifile symbols.
@ -2116,8 +2115,7 @@ IGNORE-WORDS List of words which should be removed from the string."
;; Define a menu for the menu bar if Emacs is running under X
(defvar reftex-isearch-minor-mode nil)
(make-variable-buffer-local 'reftex-isearch-minor-mode)
(defvar-local reftex-isearch-minor-mode nil)
(easy-menu-define reftex-mode-menu reftex-mode-map
"Menu used in RefTeX mode."