all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: dick.r.chiang@gmail.com
To: 37063@debbugs.gnu.org
Subject: bug#37063: 26.2.90; Problems with recent CL support in checkdoc
Date: Mon, 30 Sep 2019 12:52:36 -0400	[thread overview]
Message-ID: <87sgodiv57.fsf@dick> (raw)
In-Reply-To: <87imqw10je.fsf@cassou.me> (Damien Cassou's message of "Sat, 17 Aug 2019 13:41:57 +0200")

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: checkdoc fix --]
[-- Type: text/x-diff, Size: 2160 bytes --]

From c97b08a1d6df46f674a18ab83ae86dc6a5ad3aa0 Mon Sep 17 00:00:00 2001
From: dickmao <none>
Date: Mon, 30 Sep 2019 10:04:49 -0400
Subject: [PATCH] ; checkdoc identifying formal args

* lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info):
* test/lisp/emacs-lisp/checkdoc-tests.el: (Bug#37063)
---
 lisp/emacs-lisp/checkdoc.el            |  5 ++---
 test/lisp/emacs-lisp/checkdoc-tests.el | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 51fb75da69..6c40bdf632 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1952,11 +1952,10 @@ checkdoc-defun-info
 	;; new obarray.
 	(if (not (listp lst)) (setq lst nil))
 	(unless is-advice
-          ;; lst here can be something like ((foo bar) baz) from
+          ;; (car lst) 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)
+	    (setq ret (cons (symbol-name (car (flatten-tree (car lst)))) ret)
 		  lst (cdr lst)))))
       (nreverse ret))))
 
diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el
index 1cefc4c366..b3cc943ac0 100644
--- a/test/lisp/emacs-lisp/checkdoc-tests.el
+++ b/test/lisp/emacs-lisp/checkdoc-tests.el
@@ -50,4 +50,20 @@ checkdoc-tests--next-docstring
     (should (looking-at-p "\"baz\")"))
     (should-not (checkdoc-next-docstring))))
 
+(ert-deftest checkdoc-tests--cl-defun ()
+  "Identify formal arguments from arbitary lisp code."
+  (with-temp-buffer
+    (let ((checkdoc-autofix-flag 'never))
+      (emacs-lisp-mode)
+      (insert "(cl-defun foo(&key bar &aux (baz (baz bar))) \"BAR BAZ.\")")
+      (should-not (checkdoc-defun)))))
+
+(ert-deftest checkdoc-tests--cl-defmethod ()
+  "Identify formal arguments from object types."
+  (with-temp-buffer
+    (let ((checkdoc-autofix-flag 'never))
+      (emacs-lisp-mode)
+      (insert "(cl-defmethod foo((a list)) \"Return A.\")")
+      (should-not (checkdoc-defun)))))
+
 ;;; checkdoc-tests.el ends here
-- 
2.23.0






  reply	other threads:[~2019-09-30 16:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-17 11:41 bug#37063: 26.2.90; Problems with recent CL support in checkdoc Damien Cassou
2019-09-30 16:52 ` dick.r.chiang [this message]
2019-10-10  0:21   ` Lars Ingebrigtsen
2019-10-10  0:22 ` Lars Ingebrigtsen
2019-10-10  4:15   ` Damien Cassou
2019-10-10 16:45     ` Glenn Morris
2019-10-11  5:48       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgodiv57.fsf@dick \
    --to=dick.r.chiang@gmail.com \
    --cc=37063@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.