From 4bb62af3263057312021e076dc7e0c8ff195e38f Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 2 Oct 2024 12:19:22 +0200 Subject: [PATCH] Prefer defcustom :local specifier in textmodes * lisp/textmodes/fill.el (default-justification): * lisp/textmodes/ispell.el (ispell-local-dictionary) (ispell-skip-html): * lisp/textmodes/less-css-mode.el (less-css-output-file-name) (less-css-input-file-name): * lisp/textmodes/refer.el (refer-bib-directory, refer-bib-files) (refer-cache-bib-files): * lisp/textmodes/two-column.el (2C-separator, 2C-window-width): Prefer defcustom :local specifier to using 'make-variable-buffer-local' directly. --- lisp/textmodes/fill.el | 4 ++-- lisp/textmodes/ispell.el | 11 ++++------- lisp/textmodes/less-css-mode.el | 8 ++++---- lisp/textmodes/refer.el | 13 ++++++------- lisp/textmodes/two-column.el | 9 ++++----- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 29c56f8feaf..11c67d2dc51 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -1115,9 +1115,9 @@ The `justification' text-property can locally override this variable." (const right) (const full) (const center) - (const none)) + (const none)) + :local t :safe 'symbolp) -(make-variable-buffer-local 'default-justification) (defun current-justification () "How should we justify this line? diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 99f9e10a5a8..35550d1bbc4 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -346,12 +346,11 @@ calling \\[ispell-change-dictionary] with that value. This variable is automatically set when defined in the file with either `ispell-dictionary-keyword' or the Local Variable syntax." :type '(choice string - (const :tag "default" nil))) + (const :tag "default" nil)) + :local t) ;;;###autoload (put 'ispell-local-dictionary 'safe-local-variable 'string-or-null-p) -(make-variable-buffer-local 'ispell-local-dictionary) - (defcustom ispell-dictionary nil "Default dictionary to use if `ispell-local-dictionary' is nil." :type '(choice string @@ -377,10 +376,8 @@ such as \"&\". See `ispell-html-skip-alists' for more details. This variable affects spell-checking of HTML, XML, and SGML files." :type '(choice (const :tag "always" t) (const :tag "never" nil) - (const :tag "use-mode-name" use-mode-name))) - -(make-variable-buffer-local 'ispell-skip-html) - + (const :tag "use-mode-name" use-mode-name)) + :local t) (defcustom ispell-local-dictionary-alist nil "List of local or customized dictionary definitions. diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el index 51e62a712b4..27c94f625fc 100644 --- a/lisp/textmodes/less-css-mode.el +++ b/lisp/textmodes/less-css-mode.el @@ -115,8 +115,8 @@ This can be also be set to a full path, or a relative path. If the path is relative, it will be relative to the value of `less-css-output-dir', if set, or the current directory by default." - :type '(choice (const :tag "Default" nil) file)) -(make-variable-buffer-local 'less-css-output-file-name) + :type '(choice (const :tag "Default" nil) file) + :local t) (defcustom less-css-input-file-name nil "File name which will be compiled to CSS. @@ -131,10 +131,10 @@ variables. This can be also be set to a full path, or a relative path. If the path is relative, it will be relative to the current directory by default." - :type '(choice (const nil) file)) + :type '(choice (const nil) file) + :local t) ;;;###autoload (put 'less-css-input-file-name 'safe-local-variable #'stringp) -(make-variable-buffer-local 'less-css-input-file-name) (defconst less-css-default-error-regex "^\\(?:\e\\[31m\\)?\\([^\e\n]*\\|FileError:.*\n\\)\\(?:\e\\[39m\e\\[31m\\)? in \\(?:\e\\[39m\\)?\\([^ \r\n\t\e]+\\)\\(?:\e\\[90m\\)?\\(?::\\| on line \\)\\([0-9]+\\)\\(?::\\|, column \\)\\([0-9]+\\):?\\(?:\e\\[39m\\)?") diff --git a/lisp/textmodes/refer.el b/lisp/textmodes/refer.el index f5f4be75c03..b6707d53071 100644 --- a/lisp/textmodes/refer.el +++ b/lisp/textmodes/refer.el @@ -91,7 +91,8 @@ the default search path. Since Refer does not know that default path, it cannot search it. Include that path explicitly in your BIBINPUTS environment if you really want it searched (which is not likely to happen anyway)." - :type '(choice (repeat directory) (const bibinputs) (const texinputs))) + :type '(choice (repeat directory) (const bibinputs) (const texinputs)) + :local t) (defcustom refer-bib-files 'dir "List of \\.bib files to search for references, @@ -109,14 +110,16 @@ If `refer-bib-files' is nil, auto or dir, it is setq'd to the appropriate list of files when it is first used if `refer-cache-bib-files' is t. If `refer-cache-bib-files' is nil, the list of \\.bib files to use is re-read each time it is needed." - :type '(choice (repeat file) (const nil) (const auto) (const dir))) + :type '(choice (repeat file) (const nil) (const auto) (const dir)) + :local t) (defcustom refer-cache-bib-files t "Variable determining whether the value of `refer-bib-files' should be cached. If t, initialize the value of refer-bib-files the first time it is used. If nil, re-read the list of \\.bib files depending on the value of `refer-bib-files' each time it is needed." - :type 'boolean) + :type 'boolean + :local t) (defcustom refer-bib-files-regexp "\\\\bibliography" "Regexp matching a bibliography file declaration. @@ -130,10 +133,6 @@ If a specified file doesn't exist and has no extension, a \\.bib extension is automatically tried." :type 'regexp) -(make-variable-buffer-local 'refer-bib-files) -(make-variable-buffer-local 'refer-cache-bib-files) -(make-variable-buffer-local 'refer-bib-directory) - ;;; Internal variables (defvar refer-saved-state nil) (defvar refer-previous-keywords nil) diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el index 806d6c5e709..41cd82ce728 100644 --- a/lisp/textmodes/two-column.el +++ b/lisp/textmodes/two-column.el @@ -142,15 +142,14 @@ (defcustom 2C-separator "" "A string inserted between the two columns when merging. This gets set locally by \\[2C-split]." - :type 'string) -(put '2C-separator 'permanent-local t) + :type 'string + :local 'permanent-only) (defcustom 2C-window-width 40 "The width of the first column. (Must be at least `window-min-width'.) This value is local for every buffer that sets it." - :type 'integer) -(make-variable-buffer-local '2C-window-width) -(put '2C-window-width 'permanent-local t) + :type 'integer + :local 'permanent) (defcustom 2C-beyond-fill-column 4 "Base for calculating `fill-column' for a buffer in two-column minor mode.