emacs-diffs
[Top][All Lists]
Advanced

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

master 0762c7c: checkdoc: Don't warn about command substitutions by defa


From: Stefan Kangas
Subject: master 0762c7c: checkdoc: Don't warn about command substitutions by default
Date: Wed, 15 Sep 2021 14:37:16 -0400 (EDT)

branch: master
commit 0762c7c67fd76a2cad3ad3c8cca21e8be27a68b4
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    checkdoc: Don't warn about command substitutions by default
    
    * lisp/emacs-lisp/checkdoc.el (checkdoc-max-keyref-before-warn):
    Add new valid value nil meaning to never warn about too many command
    substitutions, and use this value as the default.  This is no longer a
    performance problem on modern machines.  (Bug#50599)
    (checkdoc-this-string-valid-engine): Respect above new valid value
    nil.
---
 lisp/emacs-lisp/checkdoc.el | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index e10ea73..e117969 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -249,11 +249,18 @@ with these words enabled."
   "List of words that are correct when spell-checking Lisp documentation.")
 ;;;###autoload(put 'checkdoc-ispell-list-words 'safe-local-variable 
#'checkdoc-list-of-strings-p)
 
-(defcustom checkdoc-max-keyref-before-warn 10
-  "The number of \\ [command-to-keystroke] tokens allowed in a doc string.
+(defcustom checkdoc-max-keyref-before-warn nil
+  "If non-nil, number of \\\\=[command-to-keystroke] tokens allowed in a doc 
string.
 Any more than this and a warning is generated suggesting that the construct
-\\ {keymap} be used instead."
-  :type 'integer)
+\\\\={keymap} be used instead.  If the value is nil, never warn.
+
+It used to not be practical to use `\\\\=[...]' very many times,
+because display of the documentation string would become slow.
+This is not an issue on modern machines, unless you have
+thousands of substitutions."
+  :type '(choice (const nil)
+                 integer)
+  :version "28.1")
 
 (defcustom checkdoc-arguments-in-order-flag nil
   "Non-nil means warn if arguments appear out of order.
@@ -1543,17 +1550,15 @@ mouse-[0-3]\\)\\)\\>"))
               " embedded in doc string.  Use \\\\<keymap> & \\\\[function] "
               "instead")
              (match-beginning 1) (match-end 1) t))))
-     ;; It is not practical to use `\\[...]' very many times, because
-     ;; display of the documentation string will become slow.  So use this
-     ;; to describe the most important commands in your major mode, and
-     ;; then use `\\{...}' to display the rest of the mode's keymap.
-     (save-excursion
-       (if (and (re-search-forward "\\\\\\\\\\[\\w+" e t
-                                  (1+ checkdoc-max-keyref-before-warn))
-               (not (re-search-forward "\\\\\\\\{\\w+}" e t)))
-          (checkdoc-create-error
-           "Too many occurrences of \\[function].  Use \\{keymap} instead"
-           s (marker-position e))))
+     ;; Optionally warn about too many command substitutions.
+     (when checkdoc-max-keyref-before-warn
+       (save-excursion
+         (if (and (re-search-forward "\\\\\\\\\\[\\w+" e t
+                                     (1+ checkdoc-max-keyref-before-warn))
+                  (not (re-search-forward "\\\\\\\\{\\w+}" e t)))
+             (checkdoc-create-error
+              "Too many occurrences of \\[function].  Use \\{keymap} instead"
+              s (marker-position e)))))
      ;; Ambiguous quoted symbol.  When a symbol is both bound and fbound,
      ;; and is referred to in documentation, it should be prefixed with
      ;; something to disambiguate it.  This check must be before the



reply via email to

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