From: Stefan Kangas Date: Tue, 2 Feb 2021 08:55:40 +0000 (+0100) Subject: Prefer defvar-local in remaining libraries X-Git-Tag: emacs-28.0.90~3972 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e0fc879c0c2185bb5858dc64eabf19ee267beac3;p=emacs.git Prefer defvar-local in remaining libraries * lisp/align.el (align-mode-rules-list) (align-mode-exclude-rules-list): * lisp/bookmark.el (bookmark-current-bookmark) (bookmark-annotation-name) (bookmark--annotation-from-bookmark-list): * lisp/calc/calc-embed.el (calc-embedded-all-active) (calc-embedded-some-active): * lisp/comint.el (comint-password-function): * lisp/completion.el (completion-syntax-table): * lisp/dframe.el (dframe-track-mouse-function) (dframe-help-echo-function, dframe-mouse-click-function) (dframe-mouse-position-function, dframe-timer) (dframe-attached-frame, dframe-controlled): * lisp/ehelp.el (electric-help-orig-major-mode): * lisp/eshell/esh-util.el (eshell-path-env): * lisp/expand.el (expand-pos, expand-index, expand-point): * lisp/face-remap.el (text-scale-mode-remapping) (text-scale-mode-lighter, text-scale-mode-amount) (text-scale-remap-header-line, buffer-face-mode-remapping): * lisp/ffap.el (ffap-menu-alist): * lisp/files-x.el (connection-local-variables-alist): * lisp/foldout.el (foldout-fold-list, foldout-mode-line-string): * lisp/follow.el (follow-start-end-invalid): * lisp/forms.el (forms--mode-setup): * lisp/gnus/message.el (message-cross-post-old-target) (message-options): * lisp/help-mode.el (help-xref-stack, help-xref-forward-stack) (help-xref-stack-item, help-xref-stack-forward-item): * lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay): * lisp/hilit-chg.el (hilit-chg-string): * lisp/ido.el (ido-eoinput): * lisp/imenu.el (imenu-generic-expression) (imenu-create-index-function, imenu-default-goto-function) (imenu-prev-index-position-function) (imenu-extract-index-name-function, imenu-name-lookup-function) (imenu-syntax-alist, imenu-case-fold-search): * lisp/jka-compr.el (jka-compr-really-do-compress): * lisp/language/ethio-util.el (ethio-prefer-ascii-space): * lisp/leim/quail/hangul.el (hangul-input-method-help-text): * lisp/leim/quail/japanese.el (quail-japanese-package-saved): * lisp/linum.el (linum-overlays, linum-available): * lisp/man.el (Man-original-frame, Man-arguments, Man--sections) (Man--refpages, Man-page-list, Man-current-page) (Man-page-mode-string): * lisp/pcomplete.el (pcomplete-current-completions) (pcomplete-last-completion-length) (pcomplete-last-completion-stub, pcomplete-last-completion-raw) (pcomplete-last-window-config, pcomplete-window-restore-timer): * lisp/reveal.el (reveal-open-spots, reveal-last-tick): * lisp/ruler-mode.el (ruler-mode): * lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save): * lisp/server.el (server-buffer-clients, server-existing-buffer): * lisp/tab-line.el (tab-line-exclude): * lisp/tar-mode.el (tar-data-buffer, tar-data-swapped): * lisp/thumbs.el (thumbs-current-tmp-filename) (thumbs-current-image-filename, thumbs-extra-images) (thumbs-image-num, thumbs-buffer, thumbs-marked-list): * lisp/tutorial.el (tutorial--point-before-chkeys) (tutorial--point-after-chkeys, tutorial--lang): * lisp/url/url-vars.el (url-current-object) (url-current-mime-headers, url-current-lastloc): * lisp/view.el (view-mode, view-old-buffer-read-only) (view-old-Helper-return-blurb, view-page-size) (view-half-page-size, view-last-regexp, view-return-to-alist) (view-exit-action, view-overlay): * lisp/wid-edit.el (widget-global-map, widget-field-new) (widget-field-list, widget-field-last, widget-field-was): * lisp/woman.el (woman-imenu-done): Prefer defvar-local. --- diff --git a/lisp/align.el b/lisp/align.el index 1318b735c05..4d783931157 100644 --- a/lisp/align.el +++ b/lisp/align.el @@ -775,18 +775,14 @@ See the documentation for `align-rules-list' for more info." ;;; Internal Variables: -(defvar align-mode-rules-list nil +(defvar-local align-mode-rules-list nil "Alignment rules specific to the current major mode. See the variable `align-rules-list' for more details.") -(make-variable-buffer-local 'align-mode-rules-list) - -(defvar align-mode-exclude-rules-list nil +(defvar-local align-mode-exclude-rules-list nil "Alignment exclusion rules specific to the current major mode. See the variable `align-exclude-rules-list' for more details.") -(make-variable-buffer-local 'align-mode-exclude-rules-list) - (defvar align-highlight-overlays nil "The current overlays highlighting the text matched by a rule.") diff --git a/lisp/bookmark.el b/lisp/bookmark.el index c857c9ba7f0..dcf8ff0d0af 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -271,13 +271,11 @@ defaults to `bookmark-default-file' and MODTIME is its modification time.") (defvar bookmark-file-coding-system nil "The coding-system of the last loaded or saved bookmark file.") -(defvar bookmark-current-bookmark nil +(defvar-local bookmark-current-bookmark nil "Name of bookmark most recently used in the current file. It is buffer local, used to make moving a bookmark forward through a file easier.") -(make-variable-buffer-local 'bookmark-current-bookmark) - (defvar bookmark-alist-modification-count 0 "Number of modifications to bookmark list since it was last saved.") @@ -903,13 +901,11 @@ Does not affect the kill ring." (when (and newline-too (= (following-char) ?\n)) (delete-char 1)))) -(defvar bookmark-annotation-name nil +(defvar-local bookmark-annotation-name nil "Name of bookmark under edit in `bookmark-edit-annotation-mode'.") -(make-variable-buffer-local 'bookmark-annotation-name) -(defvar bookmark--annotation-from-bookmark-list nil +(defvar-local bookmark--annotation-from-bookmark-list nil "If non-nil, `bookmark-edit-annotation-mode' should return to bookmark list.") -(make-variable-buffer-local 'bookmark--annotation-from-bookmark-list) (defun bookmark-default-annotation-text (bookmark-name) "Return default annotation text for BOOKMARK-NAME. diff --git a/lisp/calc/calc-embed.el b/lisp/calc/calc-embed.el index fda0b4bbedb..cfb3fda106c 100644 --- a/lisp/calc/calc-embed.el +++ b/lisp/calc/calc-embed.el @@ -46,10 +46,8 @@ (defvar calc-embedded-modes nil) (defvar calc-embedded-globals nil) (defvar calc-embedded-active nil) -(defvar calc-embedded-all-active nil) -(make-variable-buffer-local 'calc-embedded-all-active) -(defvar calc-embedded-some-active nil) -(make-variable-buffer-local 'calc-embedded-some-active) +(defvar-local calc-embedded-all-active nil) +(defvar-local calc-embedded-some-active nil) ;; The following variables are customizable and defined in calc.el. (defvar calc-embedded-announce-formula) diff --git a/lisp/comint.el b/lisp/comint.el index e52d67d0e50..432307934a7 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2375,12 +2375,11 @@ a buffer local variable." ;; saved -- typically passwords to ftp, telnet, or somesuch. ;; Just enter m-x comint-send-invisible and type in your line. -(defvar comint-password-function nil +(defvar-local comint-password-function nil "Abnormal hook run when prompted for a password. This function gets one argument, a string containing the prompt. It may return a string containing the password, or nil if normal password prompting should occur.") -(make-variable-buffer-local 'comint-password-function) (defun comint-send-invisible (&optional prompt) "Read a string without echoing. diff --git a/lisp/completion.el b/lisp/completion.el index 8810a22d262..da2fb38febc 100644 --- a/lisp/completion.el +++ b/lisp/completion.el @@ -505,9 +505,8 @@ Used to decide whether to save completions.") ;; Old name, non-namespace-clean. (defvaralias 'cmpl-syntax-table 'completion-syntax-table) -(defvar completion-syntax-table completion-standard-syntax-table +(defvar-local completion-syntax-table completion-standard-syntax-table "This variable holds the current completion syntax table.") -(make-variable-buffer-local 'completion-syntax-table) ;;----------------------------------------------- ;; Symbol functions diff --git a/lisp/dframe.el b/lisp/dframe.el index 7ea5b3364e8..e61d2ea0581 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el @@ -146,42 +146,35 @@ selected frame and the focus will change to that frame." :group 'dframe :type 'hook) -(defvar dframe-track-mouse-function nil +(defvar-local dframe-track-mouse-function nil "A function to call when the mouse is moved in the given frame. Typically used to display info about the line under the mouse.") -(make-variable-buffer-local 'dframe-track-mouse-function) -(defvar dframe-help-echo-function nil +(defvar-local dframe-help-echo-function nil "A function to call when help-echo is used in newer versions of Emacs. Typically used to display info about the line under the mouse.") -(make-variable-buffer-local 'dframe-help-echo-function) -(defvar dframe-mouse-click-function nil +(defvar-local dframe-mouse-click-function nil "A function to call when the mouse is clicked. Valid clicks are mouse 2, our double mouse 1.") -(make-variable-buffer-local 'dframe-mouse-click-function) -(defvar dframe-mouse-position-function nil +(defvar-local dframe-mouse-position-function nil "A function to call to position the cursor for a mouse click.") -(make-variable-buffer-local 'dframe-mouse-position-function) (defvar dframe-power-click nil "Never set this by hand. Value is t when S-mouse activity occurs.") -(defvar dframe-timer nil +(defvar-local dframe-timer nil "The dframe timer used for updating the buffer.") -(make-variable-buffer-local 'dframe-timer) -(defvar dframe-attached-frame nil +(defvar-local dframe-attached-frame nil "The frame which started a frame mode. This is the frame from which all interesting activities will go for the mode using dframe.") -(make-variable-buffer-local 'dframe-attached-frame) -(defvar dframe-controlled nil +(defvar-local dframe-controlled nil "Is this buffer controlled by a dedicated frame. Local to those buffers, as a function called that created it.") -(make-variable-buffer-local 'dframe-controlled) (defun dframe-update-keymap (map) "Update the keymap MAP for dframe default bindings." diff --git a/lisp/ehelp.el b/lisp/ehelp.el index 996b7db48f5..aa809d6f6f0 100644 --- a/lisp/ehelp.el +++ b/lisp/ehelp.el @@ -95,8 +95,7 @@ map) "Keymap defining commands available in `electric-help-mode'.") -(defvar electric-help-orig-major-mode nil) -(make-variable-buffer-local 'electric-help-orig-major-mode) +(defvar-local electric-help-orig-major-mode nil) (defun electric-help-mode () "`with-electric-help' temporarily places its buffer in this mode. diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 0b5cf193a14..8ef1ac9c345 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -235,11 +235,10 @@ If N or M is nil, it means the end of the list." a (last a))) a)) -(defvar eshell-path-env (getenv "PATH") +(defvar-local eshell-path-env (getenv "PATH") "Content of $PATH. It might be different from \(getenv \"PATH\"), when `default-directory' points to a remote host.") -(make-variable-buffer-local 'eshell-path-env) (defun eshell-get-path () "Return $PATH as a list. diff --git a/lisp/expand.el b/lisp/expand.el index 5c0b5f42817..9df8d9f15ac 100644 --- a/lisp/expand.el +++ b/lisp/expand.el @@ -289,17 +289,14 @@ If ARG is omitted, point is placed at the end of the expanded text." (defvar expand-list nil "Temporary variable used by the Expand package.") -(defvar expand-pos nil +(defvar-local expand-pos nil "If non-nil, store a vector with position markers defined by the last expansion.") -(make-variable-buffer-local 'expand-pos) -(defvar expand-index 0 +(defvar-local expand-index 0 "Index of the last marker used in `expand-pos'.") -(make-variable-buffer-local 'expand-index) -(defvar expand-point nil +(defvar-local expand-point nil "End of the expanded region.") -(make-variable-buffer-local 'expand-point) (defun expand-add-abbrev (table abbrev expansion arg) "Add one abbreviation and provide the hook to move to the specified positions." diff --git a/lisp/face-remap.el b/lisp/face-remap.el index c53b20f3338..7fbf0c42be7 100644 --- a/lisp/face-remap.el +++ b/lisp/face-remap.el @@ -217,21 +217,17 @@ Each positive or negative step scales the default face height by this amount." :type 'number :version "23.1") -;; current remapping cookie for text-scale-mode -(defvar text-scale-mode-remapping nil) -(make-variable-buffer-local 'text-scale-mode-remapping) +(defvar-local text-scale-mode-remapping nil + "Current remapping cookie for text-scale-mode.") -;; Lighter displayed for text-scale-mode in mode-line minor-mode list -(defvar text-scale-mode-lighter "+0") -(make-variable-buffer-local 'text-scale-mode-lighter) +(defvar-local text-scale-mode-lighter "+0" + "Lighter displayed for text-scale-mode in mode-line minor-mode list.") -;; Number of steps that text-scale-mode will increase/decrease text height -(defvar text-scale-mode-amount 0) -(make-variable-buffer-local 'text-scale-mode-amount) +(defvar-local text-scale-mode-amount 0 + "Number of steps that text-scale-mode will increase/decrease text height.") -(defvar text-scale-remap-header-line nil +(defvar-local text-scale-remap-header-line nil "If non-nil, text scaling may change font size of header lines too.") -(make-variable-buffer-local 'text-scale-header-line) (defun face-remap--clear-remappings () (dolist (remapping @@ -413,8 +409,7 @@ plist, etc." :version "23.1") ;; current remapping cookie for buffer-face-mode -(defvar buffer-face-mode-remapping nil) -(make-variable-buffer-local 'buffer-face-mode-remapping) +(defvar-local buffer-face-mode-remapping nil) ;;;###autoload (define-minor-mode buffer-face-mode diff --git a/lisp/ffap.el b/lisp/ffap.el index 1f43bafdb93..6faf8d50b26 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1675,9 +1675,8 @@ For example, try \":/\" for URL (and some FTP) references." :type '(choice (const nil) regexp) :group 'ffap) -(defvar ffap-menu-alist nil +(defvar-local ffap-menu-alist nil "Buffer local cache of menu presented by `ffap-menu'.") -(make-variable-buffer-local 'ffap-menu-alist) (defvar ffap-menu-text-plist (cond diff --git a/lisp/files-x.el b/lisp/files-x.el index 628bf180929..526a128623c 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -570,13 +570,12 @@ from the MODE alist ignoring the input argument VALUE." (defvar enable-connection-local-variables t "Non-nil means enable use of connection-local variables.") -(defvar connection-local-variables-alist nil +(defvar-local connection-local-variables-alist nil "Alist of connection-local variable settings in the current buffer. Each element in this list has the form (VAR . VALUE), where VAR is a connection-local variable (a symbol) and VALUE is its value. The actual value in the buffer may differ from VALUE, if it is changed by the user.") -(make-variable-buffer-local 'connection-local-variables-alist) (setq ignored-local-variables (cons 'connection-local-variables-alist ignored-local-variables)) diff --git a/lisp/foldout.el b/lisp/foldout.el index 4c479d68e9a..2de49d2839c 100644 --- a/lisp/foldout.el +++ b/lisp/foldout.el @@ -209,14 +209,12 @@ (require 'outline) -(defvar foldout-fold-list nil +(defvar-local foldout-fold-list nil "List of start and end markers for the folds currently entered. An end marker of nil means the fold ends after (point-max).") -(make-variable-buffer-local 'foldout-fold-list) -(defvar foldout-mode-line-string nil +(defvar-local foldout-mode-line-string nil "Mode line string announcing that we are in an outline fold.") -(make-variable-buffer-local 'foldout-mode-line-string) ;; put our minor mode string immediately following outline-minor-mode's (or (assq 'foldout-mode-line-string minor-mode-alist) diff --git a/lisp/follow.el b/lisp/follow.el index 292dc4a0225..069758747c1 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -1140,9 +1140,8 @@ Otherwise, return nil." ;; is nil. Start every window directly after the end of the previous ;; window, to make sure long lines are displayed correctly. -(defvar follow-start-end-invalid t +(defvar-local follow-start-end-invalid t "When non-nil, indicates `follow-windows-start-end-cache' is invalid.") -(make-variable-buffer-local 'follow-start-end-invalid) (defun follow-redisplay (&optional windows win preserve-win) "Reposition the WINDOWS around WIN. diff --git a/lisp/forms.el b/lisp/forms.el index 5d7e6dde96c..62c4288869a 100644 --- a/lisp/forms.el +++ b/lisp/forms.el @@ -418,9 +418,8 @@ Also, initial position is at last record." (defvar forms--parser nil "Forms parser routine.") -(defvar forms--mode-setup nil +(defvar-local forms--mode-setup nil "To keep track of forms-mode being set-up.") -(make-variable-buffer-local 'forms--mode-setup) (defvar forms--dynamic-text nil "Array that holds dynamic texts to insert between fields.") diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index d2a0092fde9..6668784f93c 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -394,9 +394,8 @@ If nil, don't insert any text in the body." ;; inspired by JoH-followup-to by Jochem Huhman ;; new suggestions by R. Weikusat -(defvar message-cross-post-old-target nil +(defvar-local message-cross-post-old-target nil "Old target for cross-posts or follow-ups.") -(make-variable-buffer-local 'message-cross-post-old-target) (defcustom message-cross-post-default t "When non-nil `message-cross-post-followup-to' will perform a crosspost. @@ -2004,9 +2003,8 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'." (User-Agent)) "Alist used for formatting headers.") -(defvar message-options nil +(defvar-local message-options nil "Some saved answers when sending message.") -(make-variable-buffer-local 'message-options) (defvar message-send-mail-real-function nil "Internal send mail function.") diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 7043f12c9a3..79710a18073 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -62,33 +62,29 @@ ["Move to Next Button" forward-button :help "Move to the Next Button in the help buffer"])) -(defvar help-xref-stack nil +(defvar-local help-xref-stack nil "A stack of ways by which to return to help buffers after following xrefs. Used by `help-follow' and `help-xref-go-back'. An element looks like (POSITION FUNCTION ARGS...). To use the element, do (apply FUNCTION ARGS) then goto the point.") (put 'help-xref-stack 'permanent-local t) -(make-variable-buffer-local 'help-xref-stack) -(defvar help-xref-forward-stack nil +(defvar-local help-xref-forward-stack nil "A stack used to navigate help forwards after using the back button. Used by `help-follow' and `help-xref-go-forward'. An element looks like (POSITION FUNCTION ARGS...). To use the element, do (apply FUNCTION ARGS) then goto the point.") (put 'help-xref-forward-stack 'permanent-local t) -(make-variable-buffer-local 'help-xref-forward-stack) -(defvar help-xref-stack-item nil +(defvar-local help-xref-stack-item nil "An item for `help-follow' in this buffer to push onto `help-xref-stack'. The format is (FUNCTION ARGS...).") (put 'help-xref-stack-item 'permanent-local t) -(make-variable-buffer-local 'help-xref-stack-item) -(defvar help-xref-stack-forward-item nil +(defvar-local help-xref-stack-forward-item nil "An item for `help-go-back' to push onto `help-xref-forward-stack'. The format is (FUNCTION ARGS...).") (put 'help-xref-stack-forward-item 'permanent-local t) -(make-variable-buffer-local 'help-xref-stack-forward-item) (setq-default help-xref-stack nil help-xref-stack-item nil) (setq-default help-xref-forward-stack nil help-xref-forward-stack-item nil) diff --git a/lisp/hexl.el b/lisp/hexl.el index 8d3cfe6de4f..85c3a53413d 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -209,12 +209,10 @@ as that will override any bit grouping options set here." (defvar hl-line-face) ;; Variables where the original values are stored to. -(defvar hexl-mode--old-var-vals ()) -(make-variable-buffer-local 'hexl-mode--old-var-vals) +(defvar-local hexl-mode--old-var-vals ()) -(defvar hexl-ascii-overlay nil +(defvar-local hexl-ascii-overlay nil "Overlay used to highlight ASCII element corresponding to current point.") -(make-variable-buffer-local 'hexl-ascii-overlay) (defvar hexl-font-lock-keywords '(("^\\([0-9a-f]+:\\)\\( \\).\\{39\\}\\( \\)\\(.+$\\)" diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el index fb33cd92e35..89a1a9108c4 100644 --- a/lisp/hilit-chg.el +++ b/lisp/hilit-chg.el @@ -296,9 +296,7 @@ remove it from existing buffers." ;; These are for internal use. (defvar hilit-chg-list nil) -(defvar hilit-chg-string " ??") - -(make-variable-buffer-local 'hilit-chg-string) +(defvar-local hilit-chg-string " ??") diff --git a/lisp/ido.el b/lisp/ido.el index 89b6a62f5a8..3ed0d952f36 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1037,10 +1037,9 @@ Should never be set permanently.") (defvar ido-completion-map nil "Currently active keymap for Ido commands.") -(defvar ido-eoinput 1 +(defvar-local ido-eoinput 1 "Point where minibuffer input ends and completion info begins. Copied from `icomplete-eoinput'.") -(make-variable-buffer-local 'ido-eoinput) (defvar ido-common-match-string nil "Stores the string that is common to all matching files.") diff --git a/lisp/imenu.el b/lisp/imenu.el index b5cd18a689d..2a557e04536 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -187,7 +187,7 @@ uses `imenu--generic-function')." :version "24.4") ;;;###autoload -(defvar imenu-generic-expression nil +(defvar-local imenu-generic-expression nil "List of definition matchers for creating an Imenu index. Each element of this list should have the form @@ -223,13 +223,10 @@ characters which normally have \"symbol\" syntax are considered to have \"word\" syntax during matching.") ;;;###autoload(put 'imenu-generic-expression 'risky-local-variable t) -;;;###autoload -(make-variable-buffer-local 'imenu-generic-expression) - ;;;; Hooks ;;;###autoload -(defvar imenu-create-index-function 'imenu-default-create-index-function +(defvar-local imenu-create-index-function 'imenu-default-create-index-function "The function to use for creating an index alist of the current buffer. It should be a function that takes no arguments and returns @@ -237,11 +234,9 @@ an index alist of the current buffer. The function is called within a `save-excursion'. See `imenu--index-alist' for the format of the buffer index alist.") -;;;###autoload -(make-variable-buffer-local 'imenu-create-index-function) ;;;###autoload -(defvar imenu-prev-index-position-function 'beginning-of-defun +(defvar-local imenu-prev-index-position-function 'beginning-of-defun "Function for finding the next index position. If `imenu-create-index-function' is set to @@ -251,21 +246,17 @@ file. The function should leave point at the place to be connected to the index and it should return nil when it doesn't find another index.") -;;;###autoload -(make-variable-buffer-local 'imenu-prev-index-position-function) ;;;###autoload -(defvar imenu-extract-index-name-function nil +(defvar-local imenu-extract-index-name-function nil "Function for extracting the index item name, given a position. This function is called after `imenu-prev-index-position-function' finds a position for an index item, with point at that position. It should return the name for that index item.") -;;;###autoload -(make-variable-buffer-local 'imenu-extract-index-name-function) ;;;###autoload -(defvar imenu-name-lookup-function nil +(defvar-local imenu-name-lookup-function nil "Function to compare string with index item. This function will be called with two strings, and should return @@ -275,15 +266,11 @@ If nil, comparison is done with `string='. Set this to some other function for more advanced comparisons, such as \"begins with\" or \"name matches and number of arguments match\".") -;;;###autoload -(make-variable-buffer-local 'imenu-name-lookup-function) ;;;###autoload -(defvar imenu-default-goto-function 'imenu-default-goto-function +(defvar-local imenu-default-goto-function 'imenu-default-goto-function "The default function called when selecting an Imenu item. The function in this variable is called when selecting a normal index-item.") -;;;###autoload -(make-variable-buffer-local 'imenu-default-goto-function) (defun imenu--subalist-p (item) @@ -554,7 +541,8 @@ Non-nil arguments are in recursive calls." (setq alist nil res elt)))) res)) -(defvar imenu-syntax-alist nil +;;;###autoload +(defvar-local imenu-syntax-alist nil "Alist of syntax table modifiers to use while in `imenu--generic-function'. The car of the assocs may be either a character or a string and the @@ -564,8 +552,6 @@ a string, all the characters in the string get the specified syntax. This is typically used to give word syntax to characters which normally have symbol syntax to simplify `imenu-expression' and speed-up matching.") -;;;###autoload -(make-variable-buffer-local 'imenu-syntax-alist) (defun imenu-default-create-index-function () "Default function to create an index alist of the current buffer. @@ -607,14 +593,13 @@ The alternate method, which is the one most often used, is to call ;;; Generic index gathering function. ;;; -(defvar imenu-case-fold-search t +;;;###autoload +(defvar-local imenu-case-fold-search t "Defines whether `imenu--generic-function' should fold case when matching. This variable should be set (only) by initialization code for modes which use `imenu--generic-function'. If it is not set, but `font-lock-defaults' is set, then font-lock's setting is used.") -;;;###autoload -(make-variable-buffer-local 'imenu-case-fold-search) ;; This function can be called with quitting disabled, ;; so it needs to be careful never to loop! diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index 877f2eb825a..8aebcd0ec4d 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el @@ -101,11 +101,10 @@ NOTE: Not used in MS-DOS and Windows systems." (defvar jka-compr-use-shell (not (memq system-type '(ms-dos windows-nt)))) -(defvar jka-compr-really-do-compress nil +(defvar-local jka-compr-really-do-compress nil "Non-nil in a buffer whose visited file was uncompressed on visiting it. This means compress the data on writing the file, even if the data appears to be compressed already.") -(make-variable-buffer-local 'jka-compr-really-do-compress) (put 'jka-compr-really-do-compress 'permanent-local t) diff --git a/lisp/language/ethio-util.el b/lisp/language/ethio-util.el index 9b5fdf24d2b..fa31cd5f9f8 100644 --- a/lisp/language/ethio-util.el +++ b/lisp/language/ethio-util.el @@ -972,8 +972,7 @@ Otherwise, [0-9A-F]." ;; Ethiopic word separator vs. ASCII space ;; -(defvar ethio-prefer-ascii-space t) -(make-variable-buffer-local 'ethio-prefer-ascii-space) +(defvar-local ethio-prefer-ascii-space t) (defun ethio-toggle-space nil "Toggle ASCII space and Ethiopic separator for keyboard input." diff --git a/lisp/leim/quail/hangul.el b/lisp/leim/quail/hangul.el index 20762d36f07..ca1aae77be3 100644 --- a/lisp/leim/quail/hangul.el +++ b/lisp/leim/quail/hangul.el @@ -511,8 +511,7 @@ When a Korean input method is off, convert the following hangul character." ;; Text shown by describe-input-method. Set to a proper text by ;; hangul-input-method-activate. -(defvar hangul-input-method-help-text nil) -(make-variable-buffer-local 'hangul-input-method-help-text) +(defvar-local hangul-input-method-help-text nil) ;;;###autoload (defun hangul-input-method-activate (input-method func help-text &rest args) diff --git a/lisp/leim/quail/japanese.el b/lisp/leim/quail/japanese.el index d7249d286fb..a4ea550c265 100644 --- a/lisp/leim/quail/japanese.el +++ b/lisp/leim/quail/japanese.el @@ -113,8 +113,7 @@ (?h . "japanese") (?q . ("japanese-ascii")))) -(defvar quail-japanese-package-saved nil) -(make-variable-buffer-local 'quail-japanese-package-saved) +(defvar-local quail-japanese-package-saved nil) (put 'quail-japanese-package-saved 'permanent-local t) (defun quail-japanese-switch-package (key idx) diff --git a/lisp/linum.el b/lisp/linum.el index 824f016271d..f9761d22c6e 100644 --- a/lisp/linum.el +++ b/lisp/linum.el @@ -34,13 +34,11 @@ (defconst linum-version "0.9x") (make-obsolete-variable 'linum-version nil "28.1") -(defvar linum-overlays nil "Overlays used in this buffer.") -(defvar linum-available nil "Overlays available for reuse.") +(defvar-local linum-overlays nil "Overlays used in this buffer.") +(defvar-local linum-available nil "Overlays available for reuse.") (defvar linum-before-numbering-hook nil "Functions run in each buffer before line numbering starts.") -(mapc #'make-variable-buffer-local '(linum-overlays linum-available)) - (defgroup linum nil "Show line numbers in the left margin." :group 'convenience) diff --git a/lisp/man.el b/lisp/man.el index ca50b3a2fa3..eb383a8439d 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -399,22 +399,15 @@ Otherwise, the value is whatever the function ;; other variables and keymap initializations -(defvar Man-original-frame) -(make-variable-buffer-local 'Man-original-frame) -(defvar Man-arguments) -(make-variable-buffer-local 'Man-arguments) +(defvar-local Man-original-frame nil) +(defvar-local Man-arguments nil) (put 'Man-arguments 'permanent-local t) -(defvar Man--sections nil) -(make-variable-buffer-local 'Man--sections) -(defvar Man--refpages nil) -(make-variable-buffer-local 'Man--refpages) -(defvar Man-page-list nil) -(make-variable-buffer-local 'Man-page-list) -(defvar Man-current-page 0) -(make-variable-buffer-local 'Man-current-page) -(defvar Man-page-mode-string "1 of 1") -(make-variable-buffer-local 'Man-page-mode-string) +(defvar-local Man--sections nil) +(defvar-local Man--refpages nil) +(defvar-local Man-page-list nil) +(defvar-local Man-current-page 0) +(defvar-local Man-page-mode-string "1 of 1") (defconst Man-sysv-sed-script "\ /\b/ { s/_\b//g diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 0dd99cec66d..7effb27af7f 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -330,19 +330,12 @@ modified to be an empty string, or the desired separation string." ;;; Internal Variables: ;; for cycling completion support -(defvar pcomplete-current-completions nil) -(defvar pcomplete-last-completion-length) -(defvar pcomplete-last-completion-stub) -(defvar pcomplete-last-completion-raw) -(defvar pcomplete-last-window-config nil) -(defvar pcomplete-window-restore-timer nil) - -(make-variable-buffer-local 'pcomplete-current-completions) -(make-variable-buffer-local 'pcomplete-last-completion-length) -(make-variable-buffer-local 'pcomplete-last-completion-stub) -(make-variable-buffer-local 'pcomplete-last-completion-raw) -(make-variable-buffer-local 'pcomplete-last-window-config) -(make-variable-buffer-local 'pcomplete-window-restore-timer) +(defvar-local pcomplete-current-completions nil) +(defvar-local pcomplete-last-completion-length nil) +(defvar-local pcomplete-last-completion-stub nil) +(defvar-local pcomplete-last-completion-raw nil) +(defvar-local pcomplete-last-window-config nil) +(defvar-local pcomplete-window-restore-timer nil) ;; used for altering pcomplete's behavior. These global variables ;; should always be nil. diff --git a/lisp/reveal.el b/lisp/reveal.el index c01afd9739a..697df45c5c3 100644 --- a/lisp/reveal.el +++ b/lisp/reveal.el @@ -67,13 +67,11 @@ revealed text manually." :type 'boolean :version "28.1") -(defvar reveal-open-spots nil +(defvar-local reveal-open-spots nil "List of spots in the buffer which are open. Each element has the form (WINDOW . OVERLAY).") -(make-variable-buffer-local 'reveal-open-spots) -(defvar reveal-last-tick nil) -(make-variable-buffer-local 'reveal-last-tick) +(defvar-local reveal-last-tick nil) ;; Actual code diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el index 1e819044194..38283a5c568 100644 --- a/lisp/ruler-mode.el +++ b/lisp/ruler-mode.el @@ -572,10 +572,9 @@ This variable is expected to be made buffer-local by modes.") Call `ruler-mode-ruler-function' to compute the ruler value.") ;;;###autoload -(defvar ruler-mode nil +(defvar-local ruler-mode nil "Non-nil if Ruler mode is enabled. Use the command `ruler-mode' to change this variable.") -(make-variable-buffer-local 'ruler-mode) (defun ruler--save-header-line-format () "Install the header line format for Ruler mode. diff --git a/lisp/scroll-lock.el b/lisp/scroll-lock.el index e8f69b29565..d283b8089ce 100644 --- a/lisp/scroll-lock.el +++ b/lisp/scroll-lock.el @@ -40,9 +40,8 @@ map) "Keymap for Scroll Lock mode.") -(defvar scroll-lock-preserve-screen-pos-save scroll-preserve-screen-position +(defvar-local scroll-lock-preserve-screen-pos-save scroll-preserve-screen-position "Used for saving the state of `scroll-preserve-screen-position'.") -(make-variable-buffer-local 'scroll-lock-preserve-screen-pos-save) (defvar scroll-lock-temporary-goal-column 0 "Like `temporary-goal-column' but for scroll-lock-* commands.") diff --git a/lisp/server.el b/lisp/server.el index b82e301d0aa..220694f6cbf 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -197,9 +197,8 @@ The created frame is selected when the hook is called." "List of current server clients. Each element is a process.") -(defvar server-buffer-clients nil +(defvar-local server-buffer-clients nil "List of client processes requesting editing of current buffer.") -(make-variable-buffer-local 'server-buffer-clients) ;; Changing major modes should not erase this local. (put 'server-buffer-clients 'permanent-local t) @@ -239,11 +238,10 @@ in this way." :type 'boolean :version "21.1") -(defvar server-existing-buffer nil +(defvar-local server-existing-buffer nil "Non-nil means the buffer existed before the server was asked to visit it. This means that the server should not kill the buffer when you say you are done with it in the server.") -(make-variable-buffer-local 'server-existing-buffer) (defvar server--external-socket-initialized nil "When an external socket is passed into Emacs, we need to call diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 9209f2d46ec..1bdddc2c83e 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -810,9 +810,7 @@ from the tab line." :version "27.1") ;;;###autoload -(defvar tab-line-exclude nil) -;;;###autoload -(make-variable-buffer-local 'tab-line-exclude) +(defvar-local tab-line-exclude nil) (defun tab-line-mode--turn-on () "Turn on `tab-line-mode'." diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index cd53d7b6ff4..89a71ac2b87 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -149,12 +149,11 @@ This information is useful, but it takes screen space away from file names." ;; So instead, we now keep the two pieces of data in separate buffers, and ;; use the new buffer-swap-text primitive when we need to change which data ;; is associated with "the" buffer. -(defvar tar-data-buffer nil "Buffer that holds the actual raw tar bytes.") -(make-variable-buffer-local 'tar-data-buffer) +(defvar-local tar-data-buffer nil + "Buffer that holds the actual raw tar bytes.") -(defvar tar-data-swapped nil +(defvar-local tar-data-swapped nil "If non-nil, `tar-data-buffer' indeed holds raw tar bytes.") -(make-variable-buffer-local 'tar-data-swapped) (defun tar-data-swapped-p () "Return non-nil if the tar-data is in `tar-data-buffer'." diff --git a/lisp/thumbs.el b/lisp/thumbs.el index 7d6558d8f78..465d097b615 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el @@ -148,36 +148,30 @@ this value can let another user see some of your images." :group 'thumbs) ;; Initialize some variable, for later use. -(defvar thumbs-current-tmp-filename nil +(defvar-local thumbs-current-tmp-filename nil "Temporary filename of current image.") -(make-variable-buffer-local 'thumbs-current-tmp-filename) -(defvar thumbs-current-image-filename nil +(defvar-local thumbs-current-image-filename nil "Filename of current image.") -(make-variable-buffer-local 'thumbs-current-image-filename) -(defvar thumbs-extra-images 1 +(defvar-local thumbs-extra-images 1 "Counter for showing extra images in thumbs buffer.") -(make-variable-buffer-local 'thumbs-extra-images) (put 'thumbs-extra-images 'permanent-local t) (defvar thumbs-current-image-size nil "Size of current image.") -(defvar thumbs-image-num nil +(defvar-local thumbs-image-num nil "Number of current image.") -(make-variable-buffer-local 'thumbs-image-num) -(defvar thumbs-buffer nil +(defvar-local thumbs-buffer nil "Name of buffer containing thumbnails associated with image.") -(make-variable-buffer-local 'thumbs-buffer) (defvar thumbs-current-dir nil "Current directory.") -(defvar thumbs-marked-list nil +(defvar-local thumbs-marked-list nil "List of marked files.") -(make-variable-buffer-local 'thumbs-marked-list) (put 'thumbs-marked-list 'permanent-local t) (defsubst thumbs-temp-dir () diff --git a/lisp/tutorial.el b/lisp/tutorial.el index 6bda1ab0d50..57e5570d537 100644 --- a/lisp/tutorial.el +++ b/lisp/tutorial.el @@ -38,17 +38,14 @@ "Face used to highlight warnings in the tutorial." :group 'help) -(defvar tutorial--point-before-chkeys 0 +(defvar-local tutorial--point-before-chkeys 0 "Point before display of key changes.") -(make-variable-buffer-local 'tutorial--point-before-chkeys) -(defvar tutorial--point-after-chkeys 0 +(defvar-local tutorial--point-after-chkeys 0 "Point after display of key changes.") -(make-variable-buffer-local 'tutorial--point-after-chkeys) -(defvar tutorial--lang nil +(defvar-local tutorial--lang nil "Tutorial language.") -(make-variable-buffer-local 'tutorial--lang) (defvar tutorial--buffer nil "The selected tutorial buffer.") diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 6493abfa056..8c836f8f64d 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el @@ -55,26 +55,19 @@ :group 'url) -(defvar url-current-object nil +(defvar-local url-current-object nil "A parsed representation of the current URL.") -(defvar url-current-mime-headers nil +(defvar-local url-current-mime-headers nil "A parsed representation of the MIME headers for the current URL.") -(defvar url-current-lastloc nil +(defvar-local url-current-lastloc nil "A parsed representation of the URL to be considered as the last location. Use of this value on outbound connections is subject to `url-privacy-level' and `url-lastloc-privacy-level'. This is never set by the url library, applications are expected to set this variable in buffers representing a displayed location.") -(mapc 'make-variable-buffer-local - '( - url-current-object - url-current-mime-headers - url-current-lastloc - )) - (defcustom url-honor-refresh-requests t "Whether to do automatic page reloads. These are done at the request of the document author or the server via diff --git a/lisp/view.el b/lisp/view.el index 5a2f2fadfc3..026c1ece304 100644 --- a/lisp/view.el +++ b/lisp/view.el @@ -96,38 +96,31 @@ interactive command; otherwise the help message is not shown." :version "22.1") ;;;###autoload -(defvar view-mode nil +(defvar-local view-mode nil "Non-nil if View mode is enabled. Don't change this variable directly, you must change it by one of the functions that enable or disable view mode.") -;;;###autoload -(make-variable-buffer-local 'view-mode) (defcustom view-mode-hook nil "Normal hook run when starting to view a buffer or file." :type 'hook :group 'view) -(defvar view-old-buffer-read-only nil) -(make-variable-buffer-local 'view-old-buffer-read-only) +(defvar-local view-old-buffer-read-only nil) -(defvar view-old-Helper-return-blurb) -(make-variable-buffer-local 'view-old-Helper-return-blurb) +(defvar-local view-old-Helper-return-blurb nil) -(defvar view-page-size nil +(defvar-local view-page-size nil "Default number of lines to scroll by View page commands. If nil that means use the window size.") -(make-variable-buffer-local 'view-page-size) -(defvar view-half-page-size nil +(defvar-local view-half-page-size nil "Default number of lines to scroll by View half page commands. If nil that means use half the window size.") -(make-variable-buffer-local 'view-half-page-size) -(defvar view-last-regexp nil) -(make-variable-buffer-local 'view-last-regexp) ; Global is better??? +(defvar-local view-last-regexp nil) ; Global is better??? -(defvar view-return-to-alist nil +(defvar-local view-return-to-alist nil "What to do with used windows and where to go when finished viewing buffer. This is local in each buffer being viewed. It is added to by `view-mode-enter' when starting to view a buffer and @@ -136,18 +129,16 @@ subtracted from by `view-mode-exit' when finished viewing the buffer. See RETURN-TO-ALIST argument of function `view-mode-exit' for the format of `view-return-to-alist'.") (make-obsolete-variable - 'view-return-to-alist "this variable is no more used." "24.1") -(make-variable-buffer-local 'view-return-to-alist) + 'view-return-to-alist "this variable is no longer used." "24.1") (put 'view-return-to-alist 'permanent-local t) -(defvar view-exit-action nil +(defvar-local view-exit-action nil "If non-nil, a function called when finished viewing. The function should take one argument (a buffer). Commands like \\[view-file] and \\[view-file-other-window] may set this to bury or kill the viewed buffer. Observe that the buffer viewed might not appear in any window at the time this function is called.") -(make-variable-buffer-local 'view-exit-action) (defvar view-no-disable-on-exit nil "If non-nil, View mode \"exit\" commands don't actually disable View mode. @@ -155,10 +146,9 @@ Instead, these commands just switch buffers or windows. This is set in certain buffers by specialized features such as help commands that use View mode automatically.") -(defvar view-overlay nil +(defvar-local view-overlay nil "Overlay used to display where a search operation found its match. This is local in each buffer, once it is used.") -(make-variable-buffer-local 'view-overlay) ;; Define keymap inside defvar to make it easier to load changes. ;; Some redundant "less"-like key bindings below have been commented out. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 68a0d3d2356..de2b5d4a7c8 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1019,9 +1019,8 @@ button end points." Recommended as a parent keymap for modes using widgets. Note that such modes will need to require wid-edit.") -(defvar widget-global-map global-map +(defvar-local widget-global-map global-map "Keymap used for events a widget does not handle itself.") -(make-variable-buffer-local 'widget-global-map) (defvar widget-field-keymap (let ((map (copy-keymap widget-keymap))) @@ -1326,13 +1325,11 @@ When not inside a field, signal an error." ;;; Setting up the buffer. -(defvar widget-field-new nil +(defvar-local widget-field-new nil "List of all newly created editable fields in the buffer.") -(make-variable-buffer-local 'widget-field-new) -(defvar widget-field-list nil +(defvar-local widget-field-list nil "List of all editable fields in the buffer.") -(make-variable-buffer-local 'widget-field-list) (defun widget-at (&optional pos) "The button or field at POS (default, point)." @@ -1359,13 +1356,11 @@ When not inside a field, signal an error." (widget-clear-undo) (widget-add-change)) -(defvar widget-field-last nil) -;; Last field containing point. -(make-variable-buffer-local 'widget-field-last) +(defvar-local widget-field-last nil + "Last field containing point.") -(defvar widget-field-was nil) -;; The widget data before the change. -(make-variable-buffer-local 'widget-field-was) +(defvar-local widget-field-was nil + "The widget data before the change.") (defun widget-field-at (pos) "Return the widget field at POS, or nil if none." diff --git a/lisp/woman.el b/lisp/woman.el index 0e4c1c10fca..1d3c8d16903 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -1078,9 +1078,8 @@ Set by `.ns' request; reset by any output or `.rs' request") ;; Could end with "\\( +\\|$\\)" instead of " *" "Regexp to match a ?roff request plus trailing white space.") -(defvar woman-imenu-done nil +(defvar-local woman-imenu-done nil "Buffer-local: set to true if function `woman-imenu' has been called.") -(make-variable-buffer-local 'woman-imenu-done) ;; From imenu.el -- needed when reformatting a file in its old buffer. ;; The latest buffer index used to update the menu bar menu.