summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/checkdoc.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-09-24 22:04:55 +0200
committerStefan Kangas <stefan@marxist.se>2021-09-24 22:04:55 +0200
commit54cfadd92f080572f6f2ccf89829d38daaa56529 (patch)
treec12f4884f85e4ed6787f3ad3e5c57d0fb22d37f5 /lisp/emacs-lisp/checkdoc.el
parent0da8118dcbf3c54dd6ecc9c0e3314a56ca82ec51 (diff)
downloademacs-54cfadd92f080572f6f2ccf89829d38daaa56529.tar.gz
emacs-54cfadd92f080572f6f2ccf89829d38daaa56529.tar.bz2
emacs-54cfadd92f080572f6f2ccf89829d38daaa56529.zip
checkdoc: Improve wide line warning to decrease false positives
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): Respect 'byte-compile-docstring-max-column' if it is set. Allow the first line to be three characters longer than the others to account for indentation and the opening string character.
Diffstat (limited to 'lisp/emacs-lisp/checkdoc.el')
-rw-r--r--lisp/emacs-lisp/checkdoc.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 06720cfa2eb..df93d392417 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1685,20 +1685,28 @@ function,command,variable,option or symbol." ms1))))))
;; first line can be wider if necessary to fit the
;; information that ought to be there.
(save-excursion
- (let ((start (point))
- (eol nil))
+ (let* ((start (point))
+ (eol nil)
+ ;; Respect this file local variable.
+ (max-column (max 80 byte-compile-docstring-max-column))
+ ;; Allow the first line to be three characters longer, to
+ ;; fit the leading ` "' while still having a docstring
+ ;; shorter than e.g. 80 characters.
+ (first t)
+ (get-max-column (lambda () (+ max-column (if first 3 0)))))
(while (and (< (point) e)
(or (progn (end-of-line) (setq eol (point))
- (< (current-column) 80))
+ (< (current-column) (funcall get-max-column)))
(progn (beginning-of-line)
(re-search-forward "\\\\\\\\[[<{]"
eol t))
- (checkdoc-in-sample-code-p start e)))
+ (checkdoc-in-sample-code-p start e)))
+ (setq first nil)
(forward-line 1))
(end-of-line)
- (if (and (< (point) e) (> (current-column) 80))
+ (if (and (< (point) e) (> (current-column) (funcall get-max-column)))
(checkdoc-create-error
- "Some lines are over 80 columns wide"
+ (format "Some lines are over %d columns wide" max-column)
s (save-excursion (goto-char s) (line-end-position))))))
;; Here we deviate to tests based on a variable or function.
;; We must do this before checking for symbols in quotes because there