diff options
| author | Stefan Kangas | 2021-09-13 21:57:13 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-09-14 07:56:06 +0200 |
| commit | cf2fa6c87f4da4665ff8a9e8e220bba0b5bccefc (patch) | |
| tree | 389f647f770237a8e004d4aeaad59c2451f42304 /lisp | |
| parent | 269c8a0b633ac22472772a7d4cce99228a5357ba (diff) | |
| download | emacs-cf2fa6c87f4da4665ff8a9e8e220bba0b5bccefc.tar.gz 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')
| -rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 29 |
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." | |||
| 312 | :version "28.1") | 312 | :version "28.1") |
| 313 | ;;;###autoload(put 'checkdoc-symbol-words 'safe-local-variable #'checkdoc-list-of-strings-p) | 313 | ;;;###autoload(put 'checkdoc-symbol-words 'safe-local-variable #'checkdoc-list-of-strings-p) |
| 314 | 314 | ||
| 315 | (defcustom checkdoc-column-zero-backslash-before-paren t | ||
| 316 | "Non-nil means to warn if there is no '\\' before '(' in column zero. | ||
| 317 | This backslash is no longer needed on Emacs 27.1 later. | ||
| 318 | |||
| 319 | See Info node `(elisp) Documentation Tips' for background." | ||
| 320 | :type 'boolean | ||
| 321 | :version "28.1") | ||
| 322 | |||
| 315 | ;;;###autoload | 323 | ;;;###autoload |
| 316 | (defun checkdoc-list-of-strings-p (obj) | 324 | (defun checkdoc-list-of-strings-p (obj) |
| 317 | "Return t when OBJ is a list of strings." | 325 | "Return t when OBJ is a list of strings." |
| @@ -1403,16 +1411,17 @@ buffer, otherwise stop after the first error." | |||
| 1403 | (match-beginning 1) | 1411 | (match-beginning 1) |
| 1404 | (match-end 1))))) | 1412 | (match-end 1))))) |
| 1405 | ;; * Check for '(' in column 0. | 1413 | ;; * Check for '(' in column 0. |
| 1406 | (save-excursion | 1414 | (when checkdoc-column-zero-backslash-before-paren |
| 1407 | (when (re-search-forward "^(" e t) | 1415 | (save-excursion |
| 1408 | (if (checkdoc-autofix-ask-replace (match-beginning 0) | 1416 | (when (re-search-forward "^(" e t) |
| 1409 | (match-end 0) | 1417 | (if (checkdoc-autofix-ask-replace (match-beginning 0) |
| 1410 | (format-message "Escape this `('? ") | 1418 | (match-end 0) |
| 1411 | "\\(") | 1419 | (format-message "Escape this `('? ") |
| 1412 | nil | 1420 | "\\(") |
| 1413 | (checkdoc-create-error | 1421 | nil |
| 1414 | "Open parenthesis in column 0 should be escaped" | 1422 | (checkdoc-create-error |
| 1415 | (match-beginning 0) (match-end 0))))) | 1423 | "Open parenthesis in column 0 should be escaped" |
| 1424 | (match-beginning 0) (match-end 0)))))) | ||
| 1416 | ;; * Do not start or end a documentation string with whitespace. | 1425 | ;; * Do not start or end a documentation string with whitespace. |
| 1417 | (let (start end) | 1426 | (let (start end) |
| 1418 | (if (or (if (looking-at "\"\\([ \t\n]+\\)") | 1427 | (if (or (if (looking-at "\"\\([ \t\n]+\\)") |