1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-10 08:10:21 -08:00

Prefer defvar-local in emacs-lisp/*.el

* lisp/emacs-lisp/chart.el (chart-local-object):
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode)
(define-globalized-minor-mode):
* lisp/emacs-lisp/edebug.el:
* lisp/emacs-lisp/generic.el (generic-font-lock-keywords):
* lisp/emacs-lisp/re-builder.el (reb-regexp, reb-regexp-src)
(reb-overlays):
* lisp/emacs-lisp/syntax.el
(syntax-propertize-extend-region-functions): Prefer defvar-local.
This commit is contained in:
Stefan Kangas 2021-01-31 14:55:53 +01:00
parent 4d635ceffb
commit 5f69c222f4
6 changed files with 10 additions and 20 deletions

View file

@ -67,9 +67,8 @@
(define-obsolete-variable-alias 'chart-map 'chart-mode-map "24.1")
(defvar chart-mode-map (make-sparse-keymap) "Keymap used in chart mode.")
(defvar chart-local-object nil
(defvar-local chart-local-object nil
"Local variable containing the locally displayed chart object.")
(make-variable-buffer-local 'chart-local-object)
(defvar chart-face-color-list '("red" "green" "blue"
"cyan" "yellow" "purple")

View file

@ -278,11 +278,10 @@ For example, you could write
((not globalp)
`(progn
:autoload-end
(defvar ,mode ,init-value
(defvar-local ,mode ,init-value
,(concat (format "Non-nil if %s is enabled.\n" pretty-name)
(internal--format-docstring-line
"Use the command `%s' to change this variable." mode)))
(make-variable-buffer-local ',mode)))
"Use the command `%s' to change this variable." mode)))))
(t
(let ((base-doc-string
(concat "Non-nil if %s is enabled.
@ -453,8 +452,7 @@ on if the hook has explicitly disabled it.
(progn
(put ',global-mode 'globalized-minor-mode t)
:autoload-end
(defvar ,MODE-major-mode nil)
(make-variable-buffer-local ',MODE-major-mode))
(defvar-local ,MODE-major-mode nil))
;; The actual global minor-mode
(define-minor-mode ,global-mode
,(concat (format "Toggle %s in all buffers.\n" pretty-name)

View file

@ -2641,12 +2641,11 @@ See `edebug-behavior-alist' for implementations.")
;; window-start now stored with each function.
;;(defvar edebug-window-start nil)
;;(defvar-local edebug-window-start nil)
;; Remember where each buffers' window starts between edebug calls.
;; This is to avoid spurious recentering.
;; Does this still need to be buffer-local??
;;(setq-default edebug-window-start nil)
;;(make-variable-buffer-local 'edebug-window-start)
;; Dynamically declared unbound vars

View file

@ -96,9 +96,8 @@
;; Internal Variables
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar generic-font-lock-keywords nil
(defvar-local generic-font-lock-keywords nil
"Keywords for `font-lock-defaults' in a generic mode.")
(make-variable-buffer-local 'generic-font-lock-keywords)
;;;###autoload
(defvar generic-mode-list nil

View file

@ -187,14 +187,14 @@ Set it to nil if you don't want limits here."
(defvar reb-target-window nil
"Window to which the RE is applied to.")
(defvar reb-regexp nil
(defvar-local reb-regexp nil
"Last regexp used by RE Builder.")
(defvar reb-regexp-src nil
(defvar-local reb-regexp-src nil
"Last regexp used by RE Builder before processing it.
Except for Lisp syntax this is the same as `reb-regexp'.")
(defvar reb-overlays nil
(defvar-local reb-overlays nil
"List of overlays of the RE Builder.")
(defvar reb-window-config nil
@ -212,10 +212,6 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
(defvar reb-valid-string ""
"String in mode line showing validity of RE.")
(make-variable-buffer-local 'reb-overlays)
(make-variable-buffer-local 'reb-regexp)
(make-variable-buffer-local 'reb-regexp-src)
(defconst reb-buffer "*RE-Builder*"
"Buffer to use for the RE Builder.")

View file

@ -75,7 +75,7 @@ properties won't work properly.")
(defvar syntax-propertize-chunk-size 500)
(defvar syntax-propertize-extend-region-functions
(defvar-local syntax-propertize-extend-region-functions
'(syntax-propertize-wholelines)
"Special hook run just before proceeding to propertize a region.
This is used to allow major modes to help `syntax-propertize' find safe buffer
@ -89,7 +89,6 @@ These functions are run in turn repeatedly until they all return nil.
Put first the functions more likely to cause a change and cheaper to compute.")
;; Mark it as a special hook which doesn't use any global setting
;; (i.e. doesn't obey the element t in the buffer-local value).
(make-variable-buffer-local 'syntax-propertize-extend-region-functions)
(cl-defstruct (ppss
(:constructor make-ppss)