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.
This commit is contained in:
Stefan Kangas 2021-01-31 16:27:26 +01:00
parent 2c74924b01
commit a5885d9d63
5 changed files with 10 additions and 19 deletions

View file

@ -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.

View file

@ -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)))

View file

@ -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))))

View file

@ -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.

View file

@ -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)