diff options
| author | Alex Branham | 2019-08-16 14:00:31 -0700 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-08-16 14:00:31 -0700 |
| commit | 496bab789d55ff20f150dd7a7d1d9bb837fb4534 (patch) | |
| tree | 2543e0b066cd23de1753b94cf170fc9bc5429494 | |
| parent | 91c7c6a60260e3820d8f4bac1e17dbec382968f9 (diff) | |
| download | emacs-496bab789d55ff20f150dd7a7d1d9bb837fb4534.tar.gz emacs-496bab789d55ff20f150dd7a7d1d9bb837fb4534.zip | |
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).
| -rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 3c699750215..8a88c5756f1 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el | |||
| @@ -933,7 +933,8 @@ don't move point." | |||
| 933 | ;; Don't bug out if the file is empty (or a | 933 | ;; Don't bug out if the file is empty (or a |
| 934 | ;; definition ends prematurely. | 934 | ;; definition ends prematurely. |
| 935 | (end-of-file))) | 935 | (end-of-file))) |
| 936 | (`(,(or 'defun 'defvar 'defcustom 'defmacro 'defconst 'defsubst 'defadvice) | 936 | (`(,(or 'defun 'defvar 'defcustom 'defmacro 'defconst 'defsubst 'defadvice |
| 937 | 'cl-defun 'cl-defgeneric 'cl-defmethod 'cl-defmacro) | ||
| 937 | ,(pred symbolp) | 938 | ,(pred symbolp) |
| 938 | ;; Require an initializer, i.e. ignore single-argument `defvar' | 939 | ;; Require an initializer, i.e. ignore single-argument `defvar' |
| 939 | ;; forms, which never have a doc string. | 940 | ;; forms, which never have a doc string. |
| @@ -1675,7 +1676,10 @@ function,command,variable,option or symbol." ms1)))))) | |||
| 1675 | (last-pos 0) | 1676 | (last-pos 0) |
| 1676 | (found 1) | 1677 | (found 1) |
| 1677 | (order (and (nth 3 fp) (car (nth 3 fp)))) | 1678 | (order (and (nth 3 fp) (car (nth 3 fp)))) |
| 1678 | (nocheck (append '("&optional" "&rest") (nth 3 fp))) | 1679 | (nocheck (append '("&optional" "&rest" "&key" "&aux" |
| 1680 | "&context" "&environment" "&whole" | ||
| 1681 | "&body" "&allow-other-keys") | ||
| 1682 | (nth 3 fp))) | ||
| 1679 | (inopts nil)) | 1683 | (inopts nil)) |
| 1680 | (while (and args found (> found last-pos)) | 1684 | (while (and args found (> found last-pos)) |
| 1681 | (if (or (member (car args) nocheck) | 1685 | (if (or (member (car args) nocheck) |
| @@ -1880,7 +1884,8 @@ the token checkdoc-order: <TOKEN> exists, and TOKEN is a symbol read | |||
| 1880 | from the comment." | 1884 | from the comment." |
| 1881 | (save-excursion | 1885 | (save-excursion |
| 1882 | (beginning-of-defun) | 1886 | (beginning-of-defun) |
| 1883 | (let ((defun (looking-at "(def\\(un\\|macro\\|subst\\|advice\\)")) | 1887 | (let ((defun (looking-at |
| 1888 | "(\\(?:cl-\\)?def\\(un\\|macro\\|subst\\|advice\\|generic\\|method\\)")) | ||
| 1884 | (is-advice (looking-at "(defadvice")) | 1889 | (is-advice (looking-at "(defadvice")) |
| 1885 | (lst nil) | 1890 | (lst nil) |
| 1886 | (ret nil) | 1891 | (ret nil) |
| @@ -1946,7 +1951,10 @@ from the comment." | |||
| 1946 | ;; This is because read will intern nil if it doesn't into the | 1951 | ;; This is because read will intern nil if it doesn't into the |
| 1947 | ;; new obarray. | 1952 | ;; new obarray. |
| 1948 | (if (not (listp lst)) (setq lst nil)) | 1953 | (if (not (listp lst)) (setq lst nil)) |
| 1949 | (if is-advice nil | 1954 | (unless is-advice |
| 1955 | ;; lst here can be something like ((foo bar) baz) from | ||
| 1956 | ;; cl-lib methods; flatten it: | ||
| 1957 | (setq lst (flatten-tree lst)) | ||
| 1950 | (while lst | 1958 | (while lst |
| 1951 | (setq ret (cons (symbol-name (car lst)) ret) | 1959 | (setq ret (cons (symbol-name (car lst)) ret) |
| 1952 | lst (cdr lst))))) | 1960 | lst (cdr lst))))) |