]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer defcustom :safe to putting 'safe-local-variable'
authorStefan Kangas <stefan@marxist.se>
Wed, 6 Jul 2022 17:56:32 +0000 (19:56 +0200)
committerStefan Kangas <stefan@marxist.se>
Wed, 6 Jul 2022 18:50:42 +0000 (20:50 +0200)
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-offset)
(lisp-body-indent, emacs-lisp-docstring-fill-column):
* lisp/files.el (version-control):
* lisp/progmodes/modula2.el (m2-indent):
* lisp/progmodes/octave.el (octave-block-offset):
* lisp/progmodes/sh-script.el (sh-basic-offset):
* lisp/progmodes/tcl.el (tcl-indent-level)
(tcl-continued-indent-level):
* lisp/simple.el (fill-prefix):
* lisp/textmodes/fill.el (colon-double-space):
* lisp/textmodes/paragraphs.el (paragraph-start)
(paragraph-separate, sentence-end-double-space)
(sentence-end-without-period, sentence-end-without-space)
(sentence-end, sentence-end-base, page-delimiter)
(paragraph-ignore-fill-prefix):
* lisp/textmodes/tex-mode.el (tex-fontify-script):
* lisp/vc/add-log.el (add-log-dont-create-changelog-file):
* lisp/vc/vc-hooks.el (vc-follow-symlinks): Prefer defcustom :safe to
putting 'safe-local-variable'.

12 files changed:
lisp/emacs-lisp/lisp-mode.el
lisp/files.el
lisp/progmodes/modula2.el
lisp/progmodes/octave.el
lisp/progmodes/sh-script.el
lisp/progmodes/tcl.el
lisp/simple.el
lisp/textmodes/fill.el
lisp/textmodes/paragraphs.el
lisp/textmodes/tex-mode.el
lisp/vc/add-log.el
lisp/vc/vc-hooks.el

index c559dd427cb322c75f0cbbdc1f87c1eb310d2300..68528e199f8d4fa625ec2789984ebd5fff0992bd 100644 (file)
@@ -838,9 +838,8 @@ or to switch back to an existing one."
 (defcustom lisp-indent-offset nil
   "If non-nil, indent second line of expressions that many more columns."
   :group 'lisp
-  :type '(choice (const nil) integer))
-(put 'lisp-indent-offset 'safe-local-variable
-     (lambda (x) (or (null x) (integerp x))))
+  :type '(choice (const nil) integer)
+  :safe (lambda (x) (or (null x) (integerp x))))
 
 (defcustom lisp-indent-function 'lisp-indent-function
   "A function to be called by `calculate-lisp-indent'.
@@ -1252,8 +1251,8 @@ Lisp function does not specify a special indentation."
 (defcustom lisp-body-indent 2
   "Number of columns to indent the second line of a `(def...)' form."
   :group 'lisp
-  :type 'integer)
-(put 'lisp-body-indent 'safe-local-variable 'integerp)
+  :type 'integer
+  :safe #'integerp)
 
 (defun lisp-indent-specform (count state indent-point normal-indent)
   (let ((containing-form-start (elt state 1))
@@ -1414,9 +1413,8 @@ Any non-integer value means do not use a different value of
 `fill-column' when filling docstrings."
   :type '(choice (integer)
                  (const :tag "Use the current `fill-column'" t))
+  :safe (lambda (x) (or (eq x t) (integerp x)))
   :group 'lisp)
-(put 'emacs-lisp-docstring-fill-column 'safe-local-variable
-     (lambda (x) (or (eq x t) (integerp x))))
 
 (defun lisp-fill-paragraph (&optional justify)
   "Like \\[fill-paragraph], but handle Emacs Lisp comments and docstrings.
index f84fe7e085b01b4dbbc21f64aaef227623abd442..992f98794373703c2e5488b17aea6cb1d6a5adf4 100644 (file)
@@ -304,16 +304,14 @@ When nil, make them for files that have some already.
 The value `never' means do not make them."
   :type '(choice (const :tag "Never" never)
                 (const :tag "If existing" nil)
-                (other :tag "Always" t))
+                 (other :tag "Always" t))
+  :safe #'version-control-safe-local-p
   :group 'backup)
 
 (defun version-control-safe-local-p (x)
   "Return whether X is safe as local value for `version-control'."
   (or (booleanp x) (equal x 'never)))
 
-(put 'version-control 'safe-local-variable
-     #'version-control-safe-local-p)
-
 (defcustom dired-kept-versions 2
   "When cleaning directory, number of versions to keep."
   :type 'natnum
index a8d644dba0ec43d31d77ce4bd56b26b18bb0222d..e668570ba17fb73c58e9cc1860b58a9caee3c595 100644 (file)
 
 (defcustom m2-indent 5
   "This variable gives the indentation in Modula-2 mode."
-  :type 'integer)
-(put 'm2-indent 'safe-local-variable
-     (lambda (v) (or (null v) (integerp v))))
+  :type 'integer
+  :safe (lambda (v) (or (null v) (integerp v))))
 
 (defconst m2-smie-grammar
   ;; An official definition can be found as "M2R10.pdf".  This grammar does
index 7b7c675873bbab6a8844603ac1dcdc421056e1ba..721dfa51ad30d02d5d3a8714c5765843727b1c10 100644 (file)
@@ -197,8 +197,8 @@ newline or semicolon after an else or end keyword."
 
 (defcustom octave-block-offset 2
   "Extra indentation applied to statements in Octave block structures."
-  :type 'integer)
-(put 'octave-block-offset 'safe-local-variable 'integerp)
+  :type 'integer
+  :safe #'integerp)
 
 (defvar octave-block-comment-start
   (concat (make-string 2 octave-comment-char) " ")
index 71fb0cd2e008a48a332d2a0b75d4ecb6fd9cebbc..be9f325d93d58a6edb98bb9e4c6450546c499d2b 100644 (file)
@@ -1156,8 +1156,8 @@ Can be set to a number, or to nil which means leave it as is."
   "The default indentation increment.
 This value is used for the `+' and `-' symbols in an indentation variable."
   :type 'integer
+  :safe #'integerp
   :group 'sh-indentation)
-(put 'sh-basic-offset 'safe-local-variable 'integerp)
 
 (defcustom sh-indent-comment t
   "How a comment line is to be indented.
index 8c179879ce2d429da5d828fd1a2654721965800c..7dae14f9e02918e63d7321c572d177f719f51d94 100644 (file)
 
 (defcustom tcl-indent-level 4
   "Indentation of Tcl statements with respect to containing block."
-  :type 'integer)
-(put 'tcl-indent-level 'safe-local-variable #'integerp)
+  :type 'integer
+  :safe #'integerp)
 
 (defcustom tcl-continued-indent-level 4
   "Indentation of continuation line relative to first line of command."
-  :type 'integer)
-(put 'tcl-continued-indent-level 'safe-local-variable #'integerp)
+  :type 'integer
+  :safe #'integerp)
 
 (defcustom tcl-auto-newline nil
   "Non-nil means automatically newline before and after braces you insert."
index e79487eba86d1620be87425ac59d0859d6f445c1..6313ce81ef916baae025d71e9b525582fc6307a8 100644 (file)
@@ -8609,10 +8609,10 @@ constitute a word."
 (defcustom fill-prefix nil
   "String for filling to insert at front of new line, or nil for none."
   :type '(choice (const :tag "None" nil)
-                string)
+                 string)
+  :safe #'string-or-null-p
   :group 'fill)
 (make-variable-buffer-local 'fill-prefix)
-(put 'fill-prefix 'safe-local-variable 'string-or-null-p)
 
 (defcustom auto-fill-inhibit-regexp nil
   "Regexp to match lines that should not be auto-filled."
index 88a8395c88a2049bb66945241fbc40d1da79e233..23ba1a24f1fbc283bd8652d929daaca1a33fe1f3 100644 (file)
@@ -46,8 +46,8 @@ A value of nil means that any change in indentation starts a new paragraph."
 
 (defcustom colon-double-space nil
   "Non-nil means put two spaces after a colon when filling."
-  :type 'boolean)
-(put 'colon-double-space 'safe-local-variable #'booleanp)
+  :type 'boolean
+  :safe #'booleanp)
 
 (defcustom fill-separate-heterogeneous-words-with-space nil
   "Non-nil means to use a space to separate words of a different kind.
index 98eb494823d4c7797c25c97200c858902d1a496c..cd726ad4776890b68c8a44bd1c35bc9555da03ea 100644 (file)
@@ -96,8 +96,8 @@ lines that start paragraphs from lines that separate them.
 
 If the variable `use-hard-newlines' is non-nil, then only lines following a
 hard newline are considered to match."
-  :type 'regexp)
-(put 'paragraph-start 'safe-local-variable #'stringp)
+  :type 'regexp
+  :safe #'stringp)
 
 ;; paragraph-start requires a hard newline, but paragraph-separate does not:
 ;; It is assumed that paragraph-separate is distinctive enough to be believed
@@ -113,8 +113,8 @@ This is matched against the text at the left margin, which is not necessarily
 the beginning of the line, so it should not use \"^\" as an anchor.  This
 ensures that the paragraph functions will work equally within a region of
 text indented by a margin setting."
-  :type 'regexp)
-(put 'paragraph-separate 'safe-local-variable #'stringp)
+  :type 'regexp
+  :safe #'stringp)
 
 (defcustom sentence-end-double-space t
   "Non-nil means a single space does not end a sentence.
@@ -125,8 +125,8 @@ This value is used by the function `sentence-end' to construct the
 regexp describing the end of a sentence, when the value of the variable
 `sentence-end' is nil.  See Info node `(elisp)Standard Regexps'."
   :type 'boolean
+  :safe #'booleanp
   :group 'fill)
-(put 'sentence-end-double-space 'safe-local-variable #'booleanp)
 
 (defcustom sentence-end-without-period nil
   "Non-nil means a sentence will end without a period.
@@ -137,8 +137,8 @@ This value is used by the function `sentence-end' to construct the
 regexp describing the end of a sentence, when the value of the variable
 `sentence-end' is nil.  See Info node `(elisp)Standard Regexps'."
   :type 'boolean
+  :safe #'booleanp
   :group 'fill)
-(put 'sentence-end-without-period 'safe-local-variable #'booleanp)
 
 (defcustom sentence-end-without-space
   "。.?!"
@@ -147,8 +147,8 @@ regexp describing the end of a sentence, when the value of the variable
 This value is used by the function `sentence-end' to construct the
 regexp describing the end of a sentence, when the value of the variable
 `sentence-end' is nil.  See Info node `(elisp)Standard Regexps'."
-  :type 'string)
-(put 'sentence-end-without-space 'safe-local-variable #'stringp)
+  :type 'string
+  :safe  #'stringp)
 
 (defcustom sentence-end nil
   "Regexp describing the end of a sentence.
@@ -158,14 +158,14 @@ All paragraph boundaries also end sentences, regardless.
 The value nil means to use the default value defined by the
 function `sentence-end'.  You should always use this function
 to obtain the value of this variable."
-  :type '(choice regexp (const :tag "Use default value" nil)))
-(put 'sentence-end 'safe-local-variable #'string-or-null-p)
+  :type '(choice regexp (const :tag "Use default value" nil))
+  :safe #'string-or-null-p)
 
 (defcustom sentence-end-base "[.?!…‽][]\"'”’)}»›]*"
   "Regexp matching the basic end of a sentence, not including following space."
   :type 'regexp
+  :safe #'stringp
   :version "25.1")
-(put 'sentence-end-base 'safe-local-variable #'stringp)
 
 (defun sentence-end ()
   "Return the regexp describing the end of a sentence.
@@ -192,14 +192,14 @@ in between.  See Info node `(elisp)Standard Regexps'."
 
 (defcustom page-delimiter "^\014"
   "Regexp describing line-beginnings that separate pages."
-  :type 'regexp)
-(put 'page-delimiter 'safe-local-variable #'stringp)
+  :type 'regexp
+  :safe #'stringp)
 
 (defcustom paragraph-ignore-fill-prefix nil
   "Non-nil means the paragraph commands are not affected by `fill-prefix'.
 This is desirable in modes where blank lines are the paragraph delimiters."
-  :type 'boolean)
-(put 'paragraph-ignore-fill-prefix 'safe-local-variable #'booleanp)
+  :type 'boolean
+  :safe #'booleanp)
 
 ;; Silence the compiler.
 (defun forward-paragraph (&optional arg)
index e90d214a1278a34206f3c9752ef2b64be84ba16a..d34133f8564525cee11b9537ddb24f4f5d8a4c1b 100644 (file)
@@ -248,9 +248,9 @@ Normally set to either `plain-tex-mode' or `latex-mode'."
 (defcustom tex-fontify-script t
   "If non-nil, fontify subscript and superscript strings."
   :type 'boolean
+  :safe #'booleanp
   :group 'tex
   :version "23.1")
-(put 'tex-fontify-script 'safe-local-variable #'booleanp)
 
 (defcustom tex-font-script-display '(-0.2 0.2)
   "How much to lower and raise subscript and superscript content.
index beaad2e835f413809e3cbbbe78a1068d9ab85217..e02d84f1f56aca109531ce3b51c6041bff47b0d4 100644 (file)
@@ -789,10 +789,9 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'."
 If a ChangeLog file does not already exist, a non-nil value
 means to put log entries in a suitably named buffer."
   :type 'boolean
+  :safe #'booleanp
   :version "27.1")
 
-(put 'add-log-dont-create-changelog-file 'safe-local-variable #'booleanp)
-
 (defun add-log--pseudo-changelog-buffer-name (changelog-file-name)
   "Compute a suitable name for a non-file visiting ChangeLog buffer.
 CHANGELOG-FILE-NAME is the file name of the actual ChangeLog file
index cc08767ade34820997b412409ed0b3a458cebaca..46e40f29c02ceb1b5902a6e0e3e695d41b97bdf4 100644 (file)
@@ -141,9 +141,9 @@ confirmation whether it should follow the link.  If nil, the link is
 visited and a warning displayed."
   :type '(choice (const :tag "Ask for confirmation" ask)
                 (const :tag "Visit link and warn" nil)
-                (const :tag "Follow link" t))
+                 (const :tag "Follow link" t))
+  :safe #'null
   :group 'vc)
-(put 'vc-follow-symlinks 'safe-local-variable #'null)
 
 (defcustom vc-display-status t
   "If non-nil, display revision number and lock status in mode line.