summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-09-13 21:57:13 +0200
committerStefan Kangas <stefan@marxist.se>2021-09-14 07:56:06 +0200
commitcf2fa6c87f4da4665ff8a9e8e220bba0b5bccefc (patch)
tree389f647f770237a8e004d4aeaad59c2451f42304 /lisp/emacs-lisp
parent269c8a0b633ac22472772a7d4cce99228a5357ba (diff)
downloademacs-cf2fa6c87f4da4665ff8a9e8e220bba0b5bccefc.tar.gz
emacs-cf2fa6c87f4da4665ff8a9e8e220bba0b5bccefc.tar.bz2
emacs-cf2fa6c87f4da4665ff8a9e8e220bba0b5bccefc.zip
Add user option to avoid checkdoc warning for unescaped left paren
* lisp/emacs-lisp/checkdoc.el (checkdoc-column-zero-backslash-before-paren): New user option to avoid warning on unescaped left parenthesis in column zero. (checkdoc-this-string-valid-engine): Respect above new option.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/checkdoc.el29
1 files changed, 19 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index bc568f10fce..3150ea605f0 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -312,6 +312,14 @@ This should be set in an Emacs Lisp file's local variables."
:version "28.1")
;;;###autoload(put 'checkdoc-symbol-words 'safe-local-variable #'checkdoc-list-of-strings-p)
+(defcustom checkdoc-column-zero-backslash-before-paren t
+ "Non-nil means to warn if there is no '\\' before '(' in column zero.
+This backslash is no longer needed on Emacs 27.1 later.
+
+See Info node `(elisp) Documentation Tips' for background."
+ :type 'boolean
+ :version "28.1")
+
;;;###autoload
(defun checkdoc-list-of-strings-p (obj)
"Return t when OBJ is a list of strings."
@@ -1403,16 +1411,17 @@ buffer, otherwise stop after the first error."
(match-beginning 1)
(match-end 1)))))
;; * Check for '(' in column 0.
- (save-excursion
- (when (re-search-forward "^(" e t)
- (if (checkdoc-autofix-ask-replace (match-beginning 0)
- (match-end 0)
- (format-message "Escape this `('? ")
- "\\(")
- nil
- (checkdoc-create-error
- "Open parenthesis in column 0 should be escaped"
- (match-beginning 0) (match-end 0)))))
+ (when checkdoc-column-zero-backslash-before-paren
+ (save-excursion
+ (when (re-search-forward "^(" e t)
+ (if (checkdoc-autofix-ask-replace (match-beginning 0)
+ (match-end 0)
+ (format-message "Escape this `('? ")
+ "\\(")
+ nil
+ (checkdoc-create-error
+ "Open parenthesis in column 0 should be escaped"
+ (match-beginning 0) (match-end 0))))))
;; * Do not start or end a documentation string with whitespace.
(let (start end)
(if (or (if (looking-at "\"\\([ \t\n]+\\)")