branch: elpa/clojure-mode
commit 1d234d0e21ff99f50abf96070f44e5a60b8cc294
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Handle comments between def form and symbol name in clojure-find-def
    
    Allow line comments in the whitespace gaps of
    clojure-def-type-and-name-regex so that forms like
    (defn ;; comment\n foo ...) are recognized correctly.
    
    Closes #686
---
 test/clojure-mode-util-test.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/clojure-mode-util-test.el b/test/clojure-mode-util-test.el
index 191f570125..3c57e332c8 100644
--- a/test/clojure-mode-util-test.el
+++ b/test/clojure-mode-util-test.el
@@ -341,6 +341,17 @@
         "(def foo 1)
          (defn bar |[x y z] z)"
         (expect (clojure-find-def) :to-equal '("defn" "bar")))
+    (with-clojure-buffer-point
+        "(defn
+   ;; comment
+   |foo [a b]
+   (+ a b))"
+        (expect (clojure-find-def) :to-equal '("defn" "foo")))
+    (with-clojure-buffer-point
+        "(defn ;; inline comment
+   |foo [a b]
+   (+ a b))"
+        (expect (clojure-find-def) :to-equal '("defn" "foo")))
     (with-clojure-buffer-point
         "(def foo 1)
          (defn ^:private bar |[x y z] z)"

Reply via email to