From a5885d9d633f0a0e2e23d5d9f48d6b70a6301442 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 31 Jan 2021 16:27:26 +0100 Subject: Prefer defvar-local in vc/*.el * lisp/vc/ediff-diff.el (ediff-whitespace, ediff-word-1) (ediff-word-2, ediff-word-3, ediff-word-4): * lisp/vc/ediff-init.el (ediff-defvar-local): * lisp/vc/smerge-mode.el (smerge-check-cache): * lisp/vc/vc-bzr.el (vc-bzr-annotation-table): * lisp/vc/vc-dispatcher.el (vc-mode-line-hook): Prefer defvar-local. --- lisp/vc/ediff-diff.el | 15 +++++---------- lisp/vc/ediff-init.el | 5 ++--- lisp/vc/smerge-mode.el | 3 +-- lisp/vc/vc-bzr.el | 3 +-- lisp/vc/vc-dispatcher.el | 3 +-- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index e90eaa11565..fde9d4338f3 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el @@ -1230,35 +1230,30 @@ are ignored." Used for splitting difference regions into individual words.") ;; \240 is Unicode symbol for nonbreakable whitespace -(defvar ediff-whitespace " \n\t\f\r\240" +(defvar-local ediff-whitespace " \n\t\f\r\240" "Characters constituting white space. These characters are ignored when differing regions are split into words.") -(make-variable-buffer-local 'ediff-whitespace) -(defvar ediff-word-1 "-[:word:]_" +(defvar-local ediff-word-1 "-[:word:]_" "Characters that constitute words of type 1. More precisely, [ediff-word-1] is a regexp that matches type 1 words. See `ediff-forward-word' for more details.") -(make-variable-buffer-local 'ediff-word-1) -(defvar ediff-word-2 "0-9.," +(defvar-local ediff-word-2 "0-9.," "Characters that constitute words of type 2. More precisely, [ediff-word-2] is a regexp that matches type 2 words. See `ediff-forward-word' for more details.") -(make-variable-buffer-local 'ediff-word-2) -(defvar ediff-word-3 "`'?!:;\"{}[]()" +(defvar-local ediff-word-3 "`'?!:;\"{}[]()" "Characters that constitute words of type 3. More precisely, [ediff-word-3] is a regexp that matches type 3 words. See `ediff-forward-word' for more details.") -(make-variable-buffer-local 'ediff-word-3) -(defvar ediff-word-4 +(defvar-local ediff-word-4 (concat "^" ediff-word-1 ediff-word-2 ediff-word-3 ediff-whitespace) "Characters that constitute words of type 4. More precisely, [ediff-word-4] is a regexp that matches type 4 words. See `ediff-forward-word' for more details.") -(make-variable-buffer-local 'ediff-word-4) ;; Split region along word boundaries. Each word will be on its own line. ;; Output to buffer out-buffer. diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 0865ac5ce41..c20d03c83d6 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -80,13 +80,12 @@ that Ediff doesn't know about.") ;; so that `kill-all-local-variables' (called by major-mode setting ;; commands) won't destroy Ediff control variables. ;; -;; Plagiarized from `emerge-defvar-local' for XEmacs. +;; Plagiarized from `emerge-defvar-local'. (defmacro ediff-defvar-local (var value doc) "Defines VAR as a local variable." (declare (indent defun) (doc-string 3)) `(progn - (defvar ,var ,value ,doc) - (make-variable-buffer-local ',var) + (defvar-local ,var ,value ,doc) (put ',var 'permanent-local t))) diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index 3b09dfe5d2e..f50b2540c55 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -173,8 +173,7 @@ Used in `smerge-diff-base-upper' and related functions." `((,smerge-command-prefix . ,smerge-basic-map)) "Keymap for `smerge-mode'.") -(defvar smerge-check-cache nil) -(make-variable-buffer-local 'smerge-check-cache) +(defvar-local smerge-check-cache nil) (defun smerge-check (n) (condition-case nil (let ((state (cons (point) (buffer-modified-tick)))) diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index e4eff486f5e..c495afb6ec5 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -860,9 +860,8 @@ If LIMIT is non-nil, show no more than this many entries." (vc-bzr-command "mv" nil 0 new old) (message "Renamed %s => %s" old new)) -(defvar vc-bzr-annotation-table nil +(defvar-local vc-bzr-annotation-table nil "Internal use.") -(make-variable-buffer-local 'vc-bzr-annotation-table) (defun vc-bzr-annotate-command (file buffer &optional revision) "Prepare BUFFER for `vc-annotate' on FILE. diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index 6b17f2afe74..2573964c42c 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -531,8 +531,7 @@ ARG and NO-CONFIRM are passed on to `revert-buffer'." (revert-buffer arg no-confirm t)) (vc-restore-buffer-context context))) -(defvar vc-mode-line-hook nil) -(make-variable-buffer-local 'vc-mode-line-hook) +(defvar-local vc-mode-line-hook nil) (put 'vc-mode-line-hook 'permanent-local t) (defvar view-old-buffer-read-only) -- cgit v1.2.3