emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 496bab7 1/2: Make checkdoc check cl-lib function do


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 496bab7 1/2: Make checkdoc check cl-lib function docstrings
Date: Fri, 16 Aug 2019 17:40:02 -0400 (EDT)

branch: master
commit 496bab789d55ff20f150dd7a7d1d9bb837fb4534
Author: Alex Branham <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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).
---
 lisp/emacs-lisp/checkdoc.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 3c699750..8a88c57 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -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)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]