diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2025-02-21 17:40:12 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2025-02-21 17:46:50 +0100 |
commit | 8d4feb214b7eb802fec34269de11d30b9382cd83 (patch) | |
tree | 3f6bc59ec214c49628d3b9f95e1850552ed6ce07 /lisp/emacs-lisp | |
parent | e7a35dac2fbe5777df531690c770b99e5f7561bb (diff) | |
download | emacs-8d4feb214b7eb802fec34269de11d30b9382cd83.tar.gz emacs-8d4feb214b7eb802fec34269de11d30b9382cd83.tar.bz2 emacs-8d4feb214b7eb802fec34269de11d30b9382cd83.zip |
New user option checkdoc-allow-quoting-nil-and-t
* lisp/emacs-lisp/checkdoc.el (checkdoc-allow-quoting-nil-and-t):
New user option that allows turning off the warning for having nil
and t in quotes.
(checkdoc-this-string-valid-engine): Use above new option.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 3541e3d0a57..95fa3a2027e 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -322,6 +322,14 @@ variable `checkdoc-common-verbs-wrong-voice' if you wish to add your own." Do not set this by hand, use a function like `checkdoc-current-buffer' with a universal argument.") +(defcustom checkdoc-allow-quoting-nil-and-t nil + "If non-nil, don't warn when the symbols nil and t are quoted. + +In other words, it allows writing them like this: \\=`nil\\=', \\=`t\\='." + :type 'boolean + :version "31.1") +;;;###autoload(put 'checkdoc-allow-quoting-nil-and-t 'safe-local-variable #'booleanp) + (defcustom checkdoc-symbol-words '("beginning-of-buffer" "beginning-of-line" "byte-code" "byte-compile" "command-line" "end-of-buffer" "end-of-line" @@ -1956,17 +1964,18 @@ Replace with \"%s\"?" original replace) (length ms))) nil))) ;; t and nil case - (save-excursion - (if (re-search-forward "\\([`‘]\\(t\\|nil\\)['’]\\)" e t) - (if (checkdoc-autofix-ask-replace - (match-beginning 1) (match-end 1) - (format "%s should not appear in quotes. Remove?" - (match-string 2)) - (match-string 2) t) - nil - (checkdoc-create-error - "Symbols t and nil should not appear in single quotes" - (match-beginning 1) (match-end 1))))) + (unless checkdoc-allow-quoting-nil-and-t + (save-excursion + (if (re-search-forward "\\([`‘]\\(t\\|nil\\)['’]\\)" e t) + (if (checkdoc-autofix-ask-replace + (match-beginning 1) (match-end 1) + (format "%s should not appear in quotes. Remove?" + (match-string 2)) + (match-string 2) t) + nil + (checkdoc-create-error + "Symbols t and nil should not appear in single quotes" + (match-beginning 1) (match-end 1)))))) ;; Here is some basic sentence formatting (checkdoc-sentencespace-region-engine (point) e) ;; Here are common proper nouns that should always appear capitalized. |