diff --git a/cider-interaction.el b/cider-interaction.el index 72bef7ccf..8cb6922ec 100644 --- a/cider-interaction.el +++ b/cider-interaction.el @@ -492,13 +492,22 @@ When invoked with a prefix ARG the command doesn't prompt for confirmation." (bounds-of-thing-at-point 'sexp))) (bounds-of-thing-at-point 'sexp))) +(defun cider--clean-symbol (symbol) + "Return SYMBOL cleaned so a dictionary match can be found." + (if (string-equal symbol "") + symbol + (let* ((symbol (if (string-equal (substring symbol 0 1) "@") + (substring symbol 1) + symbol))) + symbol))) + ;; FIXME: This doesn't have properly at the beginning of the REPL prompt (defun cider-symbol-at-point () "Return the name of the symbol at point, otherwise nil." (let ((str (substring-no-properties (or (thing-at-point 'symbol) "")))) (if (equal str (concat (cider-current-ns) "> ")) "" - str))) + (cider--clean-symbol str)))) (defun cider-sexp-at-point () "Return the sexp at point as a string, otherwise nil." diff --git a/test/cider-tests.el b/test/cider-tests.el index baf827907..458b67633 100644 --- a/test/cider-tests.el +++ b/test/cider-tests.el @@ -532,6 +532,10 @@ (cider-current-ns () "user")) (should (string= (cider-symbol-at-point) "")))) +(ert-deftest cider-symbol-at-point-deref () + (noflet ((thing-at-point (thing) "@user")) + (should (string= (cider-symbol-at-point) "user")))) + (ert-deftest test-cider--url-to-file () (should (equal "/space test" (cider--url-to-file "file:/space%20test"))) (should (equal "C:/space test" (cider--url-to-file "file:/C:/space%20test"))))