diff --git a/cider-util.el b/cider-util.el index 21c9ff1a4..9c4124434 100644 --- a/cider-util.el +++ b/cider-util.el @@ -134,7 +134,12 @@ find a symbol if there isn't one at point." (setq str (or (ignore-errors (cider-sync-request:macroexpand "macroexpand-1" str)) ""))) (unless (text-property-any 0 (length str) 'field 'cider-repl-prompt str) ;; Remove font-locking, prefix quotes, and trailing . from constructors like Record. - (string-remove-prefix "'" (string-remove-suffix "." (substring-no-properties str))))) + (thread-last (substring-no-properties str) + ;; constructurs (Foo.) + (string-remove-suffix ".") + (string-remove-prefix "'") + ;; var references (#'inc 2) + (string-remove-prefix "#'")))) (when look-back (save-excursion (ignore-errors diff --git a/test/cider-util-tests.el b/test/cider-util-tests.el index b2b163629..d99a11bdb 100644 --- a/test/cider-util-tests.el +++ b/test/cider-util-tests.el @@ -107,6 +107,11 @@ buffer." (with-clojure-buffer "'foo'bar" (expect (cider-symbol-at-point) :to-equal "foo'bar")))) + (describe "when the symbol at point is var-quoted" + (it "returns the symbol without the preceding #'" + (with-clojure-buffer "#'inc" + (expect (cider-symbol-at-point) :to-equal "inc")))) + (describe "when point is on a keyword" (it "returns the keyword along with beginning : character" (with-clojure-buffer ":abc"