emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e20ce5fcc53 1/2: Prefer defcustom :local specifier


From: Stefan Kangas
Subject: master e20ce5fcc53 1/2: Prefer defcustom :local specifier
Date: Thu, 3 Oct 2024 19:40:32 -0400 (EDT)

branch: master
commit e20ce5fcc53593db5400596afee783d966ad2b2d
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Prefer defcustom :local specifier
    
    * lisp/dirtrack.el (dirtrack-list):
    * lisp/emacs-lisp/lisp.el (defun-prompt-regexp):
    * lisp/emulation/viper-init.el
    (viper-related-files-and-buffers-ring):
    * lisp/emulation/viper-util.el (viper-syntax-preference):
    * lisp/erc/erc.el (erc-ignore-list):
    * lisp/files.el (buffer-offer-save, backup-by-copying-when-mismatch):
    * lisp/find-file.el (ff-pre-find-hook, ff-pre-load-hook)
    (ff-post-load-hook, ff-not-found-hook, ff-file-created-hook)
    (ff-case-fold-search, ff-always-in-other-window)
    (ff-ignore-include, ff-quiet-mode, ff-other-file-alist)
    (ff-search-directories):
    * lisp/mh-e/mh-e.el (mh-scan-prog):
    * lisp/newcomment.el (comment-column):
    * lisp/obsolete/rlogin.el (rlogin-directory-tracking-mode):
    * lisp/play/decipher.el (decipher-ignore-spaces):
    * lisp/plstore.el (plstore-encrypt-to):
    * lisp/proced.el (proced-format, proced-filter, proced-sort)
    (proced-descend, proced-auto-update-flag, proced-tree-flag):
    * lisp/progmodes/fortran.el (fortran-line-length):
    * lisp/shell.el (shell-history-file-name):
    * lisp/simple.el (goal-column, fill-prefix):
    * lisp/vc/ediff-init.el (ediff-use-faces)
    (ediff-highlight-all-diffs, ediff-autostore-merges):
    * lisp/vc/ediff-merg.el (ediff-show-clashes-only)
    (ediff-skip-merge-regions-that-differ-from-default): Prefer defcustom
    :local specifier to using 'make-variable-buffer-local' directly.
---
 lisp/dirtrack.el             |  3 +--
 lisp/emacs-lisp/lisp.el      |  2 +-
 lisp/emulation/viper-init.el |  2 +-
 lisp/emulation/viper-util.el |  2 +-
 lisp/erc/erc.el              |  4 ++--
 lisp/files.el                |  5 ++---
 lisp/find-file.el            | 44 ++++++++++++++++++++++----------------------
 lisp/mh-e/mh-e.el            |  2 +-
 lisp/newcomment.el           |  2 +-
 lisp/obsolete/rlogin.el      |  3 +--
 lisp/play/decipher.el        |  4 ++--
 lisp/plstore.el              |  2 +-
 lisp/proced.el               | 24 ++++++++++++------------
 lisp/progmodes/fortran.el    |  3 +--
 lisp/shell.el                |  2 +-
 lisp/simple.el               |  4 ++--
 lisp/vc/ediff-init.el        |  8 +++-----
 lisp/vc/ediff-merg.el        | 10 ++++------
 18 files changed, 59 insertions(+), 67 deletions(-)

diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el
index 07e176b8eea..8e9181f1379 100644
--- a/lisp/dirtrack.el
+++ b/lisp/dirtrack.el
@@ -126,10 +126,9 @@ First item is a regexp that describes where to find the 
path in a prompt.
 Second is a number, the regexp group to match."
   :type  '(sexp (regexp  :tag "Prompt Expression")
                (integer :tag "Regexp Group"))
+  :local t
   :version "24.1")
 
-(make-variable-buffer-local 'dirtrack-list)
-
 (defcustom dirtrack-debug nil
   "If non-nil, the function `dirtrack' will report debugging info."
   :type  'boolean)
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 280de5036aa..c9e27e78c33 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -36,8 +36,8 @@ This is only necessary if the opening paren or brace is not 
in column 0.
 See function `beginning-of-defun'."
   :type '(choice (const nil)
                 regexp)
+  :local t
   :group 'lisp)
-(make-variable-buffer-local 'defun-prompt-regexp)
 
 (defcustom parens-require-spaces t
   "If non-nil, add whitespace as needed when inserting parentheses.
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 9f724551239..e9f32b447d8 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -698,8 +698,8 @@ If nil, the cursor will move backwards without deleting 
anything."
   "List of file and buffer names to consider related to the current buffer.
 Related buffers can be cycled through via :R and :P commands."
   :type 'boolean
+  :local 'permanent-only
   :group 'viper-misc)
-(put 'viper-related-files-and-buffers-ring 'permanent-local t)
 
 ;; Used to find out if we are done with searching the current buffer.
 (defvar-local viper-local-search-start-marker nil)
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index d28c319de98..db4f12b84f9 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -1135,8 +1135,8 @@ This option is appropriate if you like Emacs-style words."
   :type '(radio (const strict-vi) (const reformed-vi)
                 (const extended) (const emacs))
   :set #'viper-set-syntax-preference
+  :local t
   :group 'viper)
-(make-variable-buffer-local 'viper-syntax-preference)
 
 
 ;; addl-chars are characters to be temporarily considered as alphanumerical
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 7de3b375752..730ec2ebb22 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1106,8 +1106,8 @@ A user identifier has the form \"nick!login@host\".  If an
 identifier matches, the message from the person will not be
 processed."
   :group 'erc-ignore
-  :type '(repeat regexp))
-(make-variable-buffer-local 'erc-ignore-list)
+  :type '(repeat regexp)
+  :local t)
 
 (defcustom erc-ignore-reply-list nil
   "List of regexps matching user identifiers to ignore completely.
diff --git a/lisp/files.el b/lisp/files.el
index c9889f3c765..b92108fac93 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -144,8 +144,8 @@ the default for a new file created there by you.
 This variable is relevant only if `backup-by-copying' is nil."
   :version "24.1"
   :type 'boolean
+  :local 'permanent-only
   :group 'backup)
-(put 'backup-by-copying-when-mismatch 'permanent-local t)
 
 (defcustom backup-by-copying-when-privileged-mismatch 200
   "Non-nil means create backups by copying to preserve a privileged owner.
@@ -178,9 +178,8 @@ use `kill-buffer-query-functions'."
   :type '(choice (const :tag "Never" nil)
                  (const :tag "On Emacs exit" t)
                  (const :tag "Whenever save-some-buffers is called" always))
+  :local 'permanent
   :group 'backup)
-(make-variable-buffer-local 'buffer-offer-save)
-(put 'buffer-offer-save 'permanent-local t)
 
 (defcustom find-file-existing-other-name t
   "Non-nil means find a file under alternative names, in existing buffers.
diff --git a/lisp/find-file.el b/lisp/find-file.el
index 23e0c12ad2c..65e980d38fc 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -130,37 +130,45 @@
 
 (defcustom ff-pre-find-hook nil
   "List of functions to be called before the search for the file starts."
-  :type 'hook)
+  :type 'hook
+  :local t)
 
 (defcustom ff-pre-load-hook nil
   "List of functions to be called before the other file is loaded."
-  :type 'hook)
+  :type 'hook
+  :local t)
 
 (defcustom ff-post-load-hook nil
   "List of functions to be called after the other file is loaded."
-  :type 'hook)
+  :type 'hook
+  :local t)
 
 (defcustom ff-not-found-hook nil
   "List of functions to be called if the other file could not be found."
-  :type 'hook)
+  :type 'hook
+  :local t)
 
 (defcustom ff-file-created-hook nil
   "List of functions to be called if the other file needs to be created."
-  :type 'hook)
+  :type 'hook
+  :local t)
 
 (defcustom ff-case-fold-search nil
   "Non-nil means ignore cases in matches (see `case-fold-search').
 If you have extensions in different cases, you will want this to be nil."
-  :type 'boolean)
+  :type 'boolean
+  :local t)
 
 (defcustom ff-always-in-other-window nil
   "If non-nil, find the corresponding file in another window by default.
 To override this, give an argument to `ff-find-other-file'."
-  :type 'boolean)
+  :type 'boolean
+  :local t)
 
 (defcustom ff-ignore-include nil
   "If non-nil, ignore `#include' lines."
-  :type 'boolean)
+  :type 'boolean
+  :local t)
 
 (defcustom ff-always-try-to-create t
   "If non-nil, always attempt to create the other file if it was not found."
@@ -168,7 +176,8 @@ To override this, give an argument to `ff-find-other-file'."
 
 (defcustom ff-quiet-mode nil
   "If non-nil, do not trace which directories are being searched."
-  :type 'boolean)
+  :type 'boolean
+  :local t)
 
 ;;;###autoload
 (defcustom ff-special-constructs
@@ -220,7 +229,8 @@ function must return a non-nil list of file-names.  It 
cannot
 return nil, nor can it signal in any way a failure to find a suitable
 list of file names."
   :type '(choice (repeat (list regexp (choice (repeat string) function)))
-                symbol))
+                 symbol)
+  :local t)
 
 (defcustom ff-search-directories 'cc-search-directories
   "List of directories to search for a specific file.
@@ -243,7 +253,8 @@ not exist, it is replaced (silently) with an empty string.
 The stars are *not* wildcards: they are searched for together with
 the preceding slash.  The star represents all the subdirectories except
 `..', and each of these subdirectories will be searched in turn."
-  :type '(choice (repeat directory) symbol))
+  :type '(choice (repeat directory) symbol)
+  :local t)
 
 (defcustom cc-search-directories
   '("." "/usr/include" "/usr/local/include/*")
@@ -294,17 +305,6 @@ is created with the first matching extension (`.cc' yields 
`.hh')."
 ;; No user definable variables beyond this point!
 ;; ==============================================
 
-(make-variable-buffer-local 'ff-pre-find-hook)
-(make-variable-buffer-local 'ff-pre-load-hook)
-(make-variable-buffer-local 'ff-post-load-hook)
-(make-variable-buffer-local 'ff-not-found-hook)
-(make-variable-buffer-local 'ff-file-created-hook)
-(make-variable-buffer-local 'ff-case-fold-search)
-(make-variable-buffer-local 'ff-always-in-other-window)
-(make-variable-buffer-local 'ff-ignore-include)
-(make-variable-buffer-local 'ff-quiet-mode)
-(make-variable-buffer-local 'ff-other-file-alist)
-(make-variable-buffer-local 'ff-search-directories)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; User entry points
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 3d686b4a777..0a72773549e 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -2008,9 +2008,9 @@ absolute pathname, it is assumed to be in the `mh-progs'
 directory. You may link another program to `scan' (see
 \"mh-profile(5)\") to produce a different type of listing."
   :type 'string
+  :local t
   :group 'mh-scan-line-formats
   :package-version '(MH-E . "6.0"))
-(make-variable-buffer-local 'mh-scan-prog)
 
 ;;; Searching (:group 'mh-search)
 
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index ee7b2ea34d8..04b5746eeae 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -109,8 +109,8 @@ can set the value for a particular mode using that mode's 
hook.
 Comments might be indented to a different value in order not to go beyond
 `comment-fill-column' or in order to align them with surrounding comments."
   :type 'integer
+  :local t
   :group 'comment)
-(make-variable-buffer-local 'comment-column)
 ;;;###autoload
 (put 'comment-column 'safe-local-variable 'integerp)
 
diff --git a/lisp/obsolete/rlogin.el b/lisp/obsolete/rlogin.el
index f285165ba21..d875405ac8b 100644
--- a/lisp/obsolete/rlogin.el
+++ b/lisp/obsolete/rlogin.el
@@ -99,10 +99,9 @@ re-syncing of directories."
   :type '(choice (const :tag "off" nil)
                 (const :tag "ftp" t)
                 (other :tag "local" local))
+  :local t
   :group 'rlogin)
 
-(make-variable-buffer-local 'rlogin-directory-tracking-mode)
-
 (defcustom rlogin-host nil
   "The name of the default remote host.  This variable is buffer-local."
   :type '(choice (const nil) string)
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el
index 56f166c10f1..805d2f93b9a 100644
--- a/lisp/play/decipher.el
+++ b/lisp/play/decipher.el
@@ -109,8 +109,8 @@ This variable must be set before typing `\\[decipher]'."
 You should set this to nil if the cipher message is divided into words,
 or t if it is not.
 This variable is buffer-local."
-  :type 'boolean)
-(make-variable-buffer-local 'decipher-ignore-spaces)
+  :type 'boolean
+  :local t)
 
 (defcustom decipher-undo-limit 5000
   "The maximum number of entries in the undo list.
diff --git a/lisp/plstore.el b/lisp/plstore.el
index db977cb6308..a33d6bca84c 100644
--- a/lisp/plstore.el
+++ b/lisp/plstore.el
@@ -236,6 +236,7 @@ If neither t nor nil, doesn't ask user."
 May either be a string or a list of strings.  If it is nil,
 symmetric encryption will be used."
   :type '(choice (const nil) (repeat :tag "Recipient(s)" string))
+  :local 'permanent-only
   :group 'plstore)
 
 ;;;###autoload
@@ -250,7 +251,6 @@ symmetric encryption will be used."
                        val)
                  t)))))
 
-(put 'plstore-encrypt-to 'permanent-local t)
 
 (defvar plstore-encoded nil
   "Non-nil if the current buffer shows the decoded alist.") ; [sic!]
diff --git a/lisp/proced.el b/lisp/proced.el
index 1d257b6bd4d..f99a6f74909 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -289,8 +289,8 @@ one, etc."
 It can be the car of an element of `proced-format-alist'.
 It can also be a list of keys appearing in `proced-grammar-alist'."
   :type '(choice (symbol :tag "Format Name")
-                 (repeat :tag "Keys" (symbol :tag ""))))
-(make-variable-buffer-local 'proced-format)
+                 (repeat :tag "Keys" (symbol :tag "")))
+  :local t)
 
 ;; FIXME: is there a better name for filter `user' that does not coincide
 ;; with an attribute key?
@@ -335,8 +335,8 @@ of `proced-filter-alist'."
                          (choice (cons :tag "Key . Regexp" (symbol :tag "Key") 
regexp)
                                  (cons :tag "Key . Function" (symbol :tag 
"Key") function)
                                  (cons :tag "Function" (const :tag "Key: 
function" function) function)
-                                 (cons :tag "Fun-all" (const :tag "Key: 
fun-all" fun-all) function)))))
-(make-variable-buffer-local 'proced-filter)
+                                 (cons :tag "Fun-all" (const :tag "Key: 
fun-all" fun-all) function))))
+  :local t)
 
 (defcustom proced-sort 'pcpu
   "Current sort scheme for proced listing.
@@ -344,13 +344,13 @@ It must be the KEY of an element of 
`proced-grammar-alist'.
 It can also be a list of KEYs as in the SORT-SCHEMEs of the elements
 of `proced-grammar-alist'."
   :type '(choice (symbol :tag "Sort Scheme")
-                 (repeat :tag "Key List" (symbol :tag "Key"))))
-(make-variable-buffer-local 'proced-sort)
+                 (repeat :tag "Key List" (symbol :tag "Key")))
+  :local t)
 
 (defcustom proced-descend t
   "Non-nil if proced listing is sorted in descending order."
-  :type '(boolean :tag "Descending Sort Order"))
-(make-variable-buffer-local 'proced-descend)
+  :type '(boolean :tag "Descending Sort Order")
+  :local t)
 
 (defcustom proced-goal-attribute 'args
   "If non-nil, key of the attribute that defines the `goal-column'."
@@ -368,13 +368,13 @@ displayed in a window.  Can be changed interactively via
 `proced-toggle-auto-update'."
   :type '(radio (const :tag "Don't auto update" nil)
                 (const :tag "Only update visible proced buffers" visible)
-                (const :tag "Update all proced buffers" t)))
-(make-variable-buffer-local 'proced-auto-update-flag)
+                (const :tag "Update all proced buffers" t))
+  :local t)
 
 (defcustom proced-tree-flag nil
   "Non-nil for display of Proced buffer as process tree."
-  :type 'boolean)
-(make-variable-buffer-local 'proced-tree-flag)
+  :type 'boolean
+  :local t)
 
 (defcustom proced-post-display-hook nil
   "Normal hook run after displaying or updating a Proced buffer.
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index 0bd807859c7..00c3d5a5cbd 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -290,6 +290,7 @@ buffer).  This corresponds to the g77 compiler option
 `-ffixed-line-length-N'."
   :type 'integer
   :safe 'integerp
+  :local t
   :initialize 'custom-initialize-default
   :set (lambda (_symbol value)
          ;; Do all fortran buffers, and the default.
@@ -297,8 +298,6 @@ buffer).  This corresponds to the g77 compiler option
   :version "23.1"
   :group 'fortran)
 
-(make-variable-buffer-local 'fortran-line-length)
-
 (defcustom fortran-mode-hook nil
   "Hook run when entering Fortran mode."
   :type  'hook
diff --git a/lisp/shell.el b/lisp/shell.el
index 14f073d6a61..965e6edcb37 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -432,8 +432,8 @@ interpreted as local file name on the remote host.
 If `shell-mode' is invoked in a local buffer, and no history file name
 can be determined, a default according to the shell type is used."
   :type '(choice (const :tag "Default" nil) (const :tag "Suppress" t) file)
+  :local 'permanent-only
   :version "30.1")
-(put 'shell-history-file-name 'permanent-local t)
 
 ;;; Basic Procedures
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 4fff24205be..e35cfe0479b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7704,8 +7704,8 @@ This has no effect when the variable `line-move-visual' 
is non-nil."
 A non-nil setting overrides the variable `line-move-visual', which see."
   :type '(choice integer
                 (const :tag "None" nil))
+  :local t
   :group 'editing-basics)
-(make-variable-buffer-local 'goal-column)
 
 (defvar temporary-goal-column 0
   "Current goal column for vertical motion.
@@ -8989,8 +8989,8 @@ treated as delimiting words.  See this command's namesake 
in Info node
   :type '(choice (const :tag "None" nil)
                  string)
   :safe #'string-or-null-p
+  :local t
   :group 'fill)
-(make-variable-buffer-local 'fill-prefix)
 
 (defcustom auto-fill-inhibit-regexp nil
   "Regexp to match lines that should not be auto-filled."
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index 72dae9b678f..085ee9140f5 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -567,9 +567,8 @@ If nil, differences are highlighted using ASCII flags, 
ediff-before-flag
 and ediff-after-flag.  On a non-window system, differences are always
 highlighted using ASCII flags."
   :type 'boolean
+  :local 'permanent
   :group 'ediff-highlighting)
-(make-variable-buffer-local 'ediff-use-faces)
-(put 'ediff-use-faces 'permanent-local t)
 
 ;; this indicates that diff regions are word-size, so fine diffs are
 ;; permanently nixed; used in ediff-windows-wordwise and ediff-regions-wordwise
@@ -611,9 +610,8 @@ reverses the meaning of this variable."
 Otherwise, all difference regions are highlighted, but the selected region is
 shown in brighter colors."
   :type 'boolean
+  :local 'permanent
   :group 'ediff-highlighting)
-(make-variable-buffer-local 'ediff-highlight-all-diffs)
-(put 'ediff-highlight-all-diffs 'permanent-local t)
 
 
 (ediff-defvar-local ediff-control-buffer-suffix nil
@@ -1200,8 +1198,8 @@ save.  Anything else means save automatically only if the 
merge
 job is part of a group of jobs, such as `ediff-merge-directory'
 or `ediff-merge-directory-revisions'."
   :type '(choice (const nil) (const t) (const group-jobs-only))
+  :local t
   :group 'ediff-merge)
-(make-variable-buffer-local 'ediff-autostore-merges)
 
 (ediff-defvar-local ediff-merge-store-file nil
   "File where the result of the merge is to be saved.  Internal.")
diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el
index 606c23cb8aa..294880a4c49 100644
--- a/lisp/vc/ediff-merg.el
+++ b/lisp/vc/ediff-merg.el
@@ -73,9 +73,8 @@ STRING4"
 This means that regions that have status prefer-A or prefer-B will be
 skipped over.  A value of nil means show all regions."
   :type 'boolean
-  :group 'ediff-merge
-  )
-(make-variable-buffer-local 'ediff-show-clashes-only)
+  :local t
+  :group 'ediff-merge)
 
 (defcustom ediff-skip-merge-regions-that-differ-from-default nil
   "If t, show only the regions that have not been changed by the user.
@@ -87,9 +86,8 @@ A region is considered to have been changed also when it is 
marked as
 Buffer A or if it is marked as `prefer-B' and is different from the region in
 Buffer B."
   :type 'boolean
-  :group 'ediff-merge
-  )
-(make-variable-buffer-local 'ediff-skip-merge-regions-that-differ-from-default)
+  :local t
+  :group 'ediff-merge)
 
 (defvar state-of-merge)                        ; dynamic var
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]