Skip to content

Commit d47c0e1

Browse files
committed
Handle var-quotes on symbols
1 parent 7f4d4e8 commit d47c0e1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cider-util.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ find a symbol if there isn't one at point."
134134
(setq str (or (ignore-errors (cider-sync-request:macroexpand "macroexpand-1" str)) "")))
135135
(unless (text-property-any 0 (length str) 'field 'cider-repl-prompt str)
136136
;; Remove font-locking, prefix quotes, and trailing . from constructors like Record.
137-
(string-remove-prefix "'" (string-remove-suffix "." (substring-no-properties str)))))
137+
(thread-last (substring-no-properties str)
138+
;; constructurs (Foo.)
139+
(string-remove-suffix ".")
140+
(string-remove-prefix "'")
141+
;; var references (#'inc 2)
142+
(string-remove-prefix "#'"))))
138143
(when look-back
139144
(save-excursion
140145
(ignore-errors

test/cider-util-tests.el

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ buffer."
107107
(with-clojure-buffer "'foo'bar"
108108
(expect (cider-symbol-at-point) :to-equal "foo'bar"))))
109109

110+
(describe "when the symbol at point is var-quoted"
111+
(it "returns the symbol without the preceding #'"
112+
(with-clojure-buffer "#'inc"
113+
(expect (cider-symbol-at-point) :to-equal "inc"))))
114+
110115
(describe "when point is on a keyword"
111116
(it "returns the keyword along with beginning : character"
112117
(with-clojure-buffer ":abc"

0 commit comments

Comments
 (0)