[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3e7f6ff4b0 1/2: Prefer defcustom :safe to putting 'safe-local-var
From: |
Stefan Kangas |
Subject: |
master 3e7f6ff4b0 1/2: Prefer defcustom :safe to putting 'safe-local-variable' |
Date: |
Wed, 6 Jul 2022 14:55:48 -0400 (EDT) |
branch: master
commit 3e7f6ff4b09760c92b1a6b1a193d08c52f37675a
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
Prefer defcustom :safe to putting 'safe-local-variable'
* 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'.
---
lisp/emacs-lisp/lisp-mode.el | 12 +++++-------
lisp/files.el | 6 ++----
lisp/progmodes/modula2.el | 5 ++---
lisp/progmodes/octave.el | 4 ++--
lisp/progmodes/sh-script.el | 2 +-
lisp/progmodes/tcl.el | 8 ++++----
lisp/simple.el | 4 ++--
lisp/textmodes/fill.el | 4 ++--
lisp/textmodes/paragraphs.el | 30 +++++++++++++++---------------
lisp/textmodes/tex-mode.el | 2 +-
lisp/vc/add-log.el | 3 +--
lisp/vc/vc-hooks.el | 4 ++--
12 files changed, 39 insertions(+), 45 deletions(-)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index c559dd427c..68528e199f 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -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.
diff --git a/lisp/files.el b/lisp/files.el
index f84fe7e085..992f987943 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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
diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
index a8d644dba0..e668570ba1 100644
--- a/lisp/progmodes/modula2.el
+++ b/lisp/progmodes/modula2.el
@@ -101,9 +101,8 @@
(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
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 7b7c675873..721dfa51ad 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -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) " ")
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 71fb0cd2e0..be9f325d93 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -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.
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 8c179879ce..7dae14f9e0 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -120,13 +120,13 @@
(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."
diff --git a/lisp/simple.el b/lisp/simple.el
index e79487eba8..6313ce81ef 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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."
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 88a8395c88..23ba1a24f1 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -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.
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 98eb494823..cd726ad477 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -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)
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index e90d214a12..d34133f856 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -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.
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index beaad2e835..e02d84f1f5 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -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
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index cc08767ade..46e40f29c0 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -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.