emacs-diffs
[Top][All Lists]
Advanced

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

master 196eebda16: Make checkdoc-defun-info parsing slightly less wrong


From: Lars Ingebrigtsen
Subject: master 196eebda16: Make checkdoc-defun-info parsing slightly less wrong
Date: Sun, 19 Jun 2022 08:17:41 -0400 (EDT)

branch: master
commit 196eebda168aaf7fec493cf4c38207969904abf3
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make checkdoc-defun-info parsing slightly less wrong
    
    * lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info): Disregard
    `interactive' in nested parts of the defun (bug#56052).
---
 lisp/emacs-lisp/checkdoc.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 7ae01d03b0..2cb5fa120e 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -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))))



reply via email to

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