Make checkdoc check cl-lib function docstrings

* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
Remove calls to delete-region to avoid deleting final " (bug#26328).
* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring)
(checkdoc-defun-info): Include cl-defun, cl-defgeneric,
cl-defmethod.
(checkdoc-this-string-valid-engine): Add cl-lib supported
keywords.
(checkdoc-defun-info): Ensure function parameters are a
"flat" list (bug#37034).
This commit is contained in:
Alex Branham
2019-08-16 14:00:31 -07:00
committed by Lars Ingebrigtsen
parent 91c7c6a602
commit 496bab789d

View File

@@ -933,7 +933,8 @@ don't move point."
;; Don't bug out if the file is empty (or a
;; definition ends prematurely.
(end-of-file)))
(`(,(or 'defun 'defvar 'defcustom 'defmacro 'defconst 'defsubst 'defadvice)
(`(,(or 'defun 'defvar 'defcustom 'defmacro 'defconst 'defsubst 'defadvice
'cl-defun 'cl-defgeneric 'cl-defmethod 'cl-defmacro)
,(pred symbolp)
;; Require an initializer, i.e. ignore single-argument `defvar'
;; forms, which never have a doc string.
@@ -1675,7 +1676,10 @@ function,command,variable,option or symbol." ms1))))))
(last-pos 0)
(found 1)
(order (and (nth 3 fp) (car (nth 3 fp))))
(nocheck (append '("&optional" "&rest") (nth 3 fp)))
(nocheck (append '("&optional" "&rest" "&key" "&aux"
"&context" "&environment" "&whole"
"&body" "&allow-other-keys")
(nth 3 fp)))
(inopts nil))
(while (and args found (> found last-pos))
(if (or (member (car args) nocheck)
@@ -1880,7 +1884,8 @@ the token checkdoc-order: <TOKEN> exists, and TOKEN is a symbol read
from the comment."
(save-excursion
(beginning-of-defun)
(let ((defun (looking-at "(def\\(un\\|macro\\|subst\\|advice\\)"))
(let ((defun (looking-at
"(\\(?:cl-\\)?def\\(un\\|macro\\|subst\\|advice\\|generic\\|method\\)"))
(is-advice (looking-at "(defadvice"))
(lst nil)
(ret nil)
@@ -1946,7 +1951,10 @@ from the comment."
;; This is because read will intern nil if it doesn't into the
;; new obarray.
(if (not (listp lst)) (setq lst nil))
(if is-advice nil
(unless is-advice
;; lst here can be something like ((foo bar) baz) from
;; cl-lib methods; flatten it:
(setq lst (flatten-tree lst))
(while lst
(setq ret (cons (symbol-name (car lst)) ret)
lst (cdr lst)))))