From 09e99053470ef19d75c4b000d5ebe848288d60dd Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 31 Jan 2021 15:00:41 +0100 Subject: Prefer defvar-local in nxml/*.el * lisp/nxml/rng-cmpct.el (rng-c-current-token) (rng-c-escape-positions, rng-c-file-name): * lisp/nxml/rng-pttrn.el (rng-current-schema): * lisp/nxml/rng-valid.el (rng-validate-timer) (rng-validate-quick-timer, rng-error-count, rng-message-overlay) (rng-message-overlay-inhibit-point, rng-message-overlay-current) (rng-validate-up-to-date-end, rng-conditional-up-to-date-start) (rng-conditional-up-to-date-end, rng-dtd): Prefer defvar-local. --- lisp/nxml/rng-cmpct.el | 9 +++------ lisp/nxml/rng-pttrn.el | 3 +-- lisp/nxml/rng-valid.el | 30 ++++++++++-------------------- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el index dcbd7ed1dd7..45a69a73f35 100644 --- a/lisp/nxml/rng-cmpct.el +++ b/lisp/nxml/rng-cmpct.el @@ -123,8 +123,7 @@ Return a pattern." (set-buffer-multibyte t) (set-syntax-table rng-c-syntax-table)) -(defvar rng-c-current-token nil) -(make-variable-buffer-local 'rng-c-current-token) +(defvar-local rng-c-current-token nil) (defun rng-c-advance () (cond ((looking-at rng-c-token-re) @@ -334,11 +333,9 @@ OVERRIDE is either nil, require or t." ;;; Parsing -(defvar rng-c-escape-positions nil) -(make-variable-buffer-local 'rng-c-escape-positions) +(defvar-local rng-c-escape-positions nil) -(defvar rng-c-file-name nil) -(make-variable-buffer-local 'rng-c-file-name) +(defvar-local rng-c-file-name nil) (defvar rng-c-file-index nil) diff --git a/lisp/nxml/rng-pttrn.el b/lisp/nxml/rng-pttrn.el index 12ffa578200..034671feeb0 100644 --- a/lisp/nxml/rng-pttrn.el +++ b/lisp/nxml/rng-pttrn.el @@ -66,9 +66,8 @@ (defvar rng-schema-change-hook nil "Hook to be run after `rng-current-schema' changes.") -(defvar rng-current-schema nil +(defvar-local rng-current-schema nil "Pattern to be used as schema for the current buffer.") -(make-variable-buffer-local 'rng-current-schema) (defun rng-make-ref (name) (list 'ref nil name)) diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index 6ea893404cb..a5eb893c554 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el @@ -132,36 +132,30 @@ A quick validation validates at most one chunk." ;; Global variables -(defvar rng-validate-timer nil) -(make-variable-buffer-local 'rng-validate-timer) +(defvar-local rng-validate-timer nil) ;; ensure that we can cancel the timer even after a kill-all-local-variables (put 'rng-validate-timer 'permanent-local t) -(defvar rng-validate-quick-timer nil) -(make-variable-buffer-local 'rng-validate-quick-timer) +(defvar-local rng-validate-quick-timer nil) ;; ensure that we can cancel the timer even after a kill-all-local-variables (put 'rng-validate-quick-timer 'permanent-local t) -(defvar rng-error-count nil +(defvar-local rng-error-count nil "Number of errors in the current buffer. Always equal to number of overlays with category `rng-error'.") -(make-variable-buffer-local 'rng-error-count) -(defvar rng-message-overlay nil +(defvar-local rng-message-overlay nil "Overlay in this buffer whose `help-echo' property was last printed. It is nil if none.") -(make-variable-buffer-local 'rng-message-overlay) -(defvar rng-message-overlay-inhibit-point nil +(defvar-local rng-message-overlay-inhibit-point nil "Position at which message from overlay should be inhibited. If point is equal to this and the error overlay around point is `rng-message-overlay', then the `help-echo' property of the error overlay should not be printed with `message'.") -(make-variable-buffer-local 'rng-message-overlay-inhibit-point) -(defvar rng-message-overlay-current nil +(defvar-local rng-message-overlay-current nil "Non-nil if `rng-message-overlay' is still the current message.") -(make-variable-buffer-local 'rng-message-overlay-current) (defvar rng-open-elements nil "Stack of names of open elements represented as a list. @@ -178,11 +172,10 @@ indicating an unresolvable entity or character reference.") (defvar rng-collecting-text nil) -(defvar rng-validate-up-to-date-end nil +(defvar-local rng-validate-up-to-date-end nil "Last position where validation is known to be up to date.") -(make-variable-buffer-local 'rng-validate-up-to-date-end) -(defvar rng-conditional-up-to-date-start nil +(defvar-local rng-conditional-up-to-date-start nil "Marker for the start of the conditionally up-to-date region. It is nil if there is no conditionally up-to-date region. The conditionally up-to-date region must be such that for any cached @@ -191,20 +184,17 @@ if at some point it is determined that S becomes correct for P, then all states with position >= P in the conditionally up to date region must also then be correct and all errors between P and the end of the region must then be correctly marked.") -(make-variable-buffer-local 'rng-conditional-up-to-date-start) -(defvar rng-conditional-up-to-date-end nil +(defvar-local rng-conditional-up-to-date-end nil "Marker for the end of the conditionally up-to-date region. It is nil if there is no conditionally up-to-date region. See the variable `rng-conditional-up-to-date-start'.") -(make-variable-buffer-local 'rng-conditional-up-to-date-end) (defvar rng-parsing-for-state nil "Non-nil means we are currently parsing just to compute the state. Should be dynamically bound.") -(defvar rng-dtd nil) -(make-variable-buffer-local 'rng-dtd) +(defvar-local rng-dtd nil) ;;;###autoload (define-minor-mode rng-validate-mode -- cgit v1.2.3