[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5f69c22 4/6: Prefer defvar-local in emacs-lisp/*.el

From: Stefan Kangas
Subject: master 5f69c22 4/6: Prefer defvar-local in emacs-lisp/*.el
Date: Sun, 31 Jan 2021 10:05:18 -0500 (EST)

branch: master
commit 5f69c222f47dfb339304b57083cb68c1da340271
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Prefer defvar-local in emacs-lisp/*.el
    * lisp/emacs-lisp/chart.el (chart-local-object):
    * lisp/emacs-lisp/easy-mmode.el (define-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)
    * lisp/emacs-lisp/syntax.el
    (syntax-propertize-extend-region-functions): Prefer defvar-local.
 lisp/emacs-lisp/chart.el      |  3 +--
 lisp/emacs-lisp/easy-mmode.el |  8 +++-----
 lisp/emacs-lisp/edebug.el     |  3 +--
 lisp/emacs-lisp/generic.el    |  3 +--
 lisp/emacs-lisp/re-builder.el | 10 +++-------
 lisp/emacs-lisp/syntax.el     |  3 +--
 6 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 2cd7322..7d760ff 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -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")
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index f4dbcee..54c0cf0 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -278,11 +278,10 @@ For example, you could write
          ((not globalp)
-             (defvar ,mode ,init-value
+             (defvar-local ,mode ,init-value
                ,(concat (format "Non-nil if %s is enabled.\n" pretty-name)
-                         "Use the command `%s' to change this variable." 
-             (make-variable-buffer-local ',mode)))
+                         "Use the command `%s' to change this variable." 
          (let ((base-doc-string
                  (concat "Non-nil if %s is enabled.
@@ -453,8 +452,7 @@ on if the hook has explicitly disabled it.
          (put ',global-mode 'globalized-minor-mode t)
-         (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)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 1ded0e7..84191af 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -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
diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el
index 6db1bbb..294aba6 100644
--- a/lisp/emacs-lisp/generic.el
+++ b/lisp/emacs-lisp/generic.el
@@ -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)
 (defvar generic-mode-list nil
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 23221a2..ce8d98d 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -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.")
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 62f213c..bee2f96 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -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
   "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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]