]> git.eshelyaron.com Git - emacs.git/commitdiff
Make checkdoc-defun-info parsing slightly less wrong
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 19 Jun 2022 12:17:05 +0000 (14:17 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 19 Jun 2022 12:17:05 +0000 (14:17 +0200)
* lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info): Disregard
`interactive' in nested parts of the defun (bug#56052).

lisp/emacs-lisp/checkdoc.el

index 7ae01d03b041f6377cd877dcbb08537fee9e7246..2cb5fa120e0e9b0ebdf8c2c9e0fb2d84a87dcd27 100644 (file)
@@ -2007,6 +2007,7 @@ from the comment."
     (let ((defun (looking-at
                   "(\\(?:cl-\\)?def\\(un\\|macro\\|subst\\|advice\\|generic\\|method\\)"))
          (is-advice (looking-at "(defadvice"))
+          (defun-depth (ppss-depth (syntax-ppss)))
          (lst nil)
          (ret nil)
          (oo (make-vector 3 0)))       ;substitute obarray for `read'
@@ -2022,11 +2023,17 @@ from the comment."
        (setq ret (cons nil ret))
        ;; Interactive
        (save-excursion
-         (setq ret (cons
-                    (re-search-forward "^\\s-*(interactive"
-                                       (save-excursion (end-of-defun) (point))
-                                       t)
-                    ret)))
+          (push (and (re-search-forward "^\\s-*(interactive"
+                                       (save-excursion
+                                          (end-of-defun)
+                                          (point))
+                                       t)
+                     ;; Disregard `interactive' from other parts of
+                     ;; the function.
+                     (= (ppss-depth (syntax-ppss))
+                        (+ defun-depth 2))
+                     (point))
+                ret))
        (skip-chars-forward " \t\n")
        (let ((bss (buffer-substring (point) (save-excursion (forward-sexp 1)
                                                             (point))))