summaryrefslogtreecommitdiff
path: root/cider-util.el
diff options
context:
space:
mode:
authorLars Andersen <expez@expez.com>2015-09-16 10:38:14 +0200
committerLars Andersen <lars.andersen@gjensidige.no>2015-09-18 09:17:00 +0200
commit9eedb0562f878c0903c10c1194dd7f032d20abe1 (patch)
tree41b644a1d506c0db74e1ae26d00d4c41c6376751 /cider-util.el
parent5aa4aceedf386f0792ebd67596dbfde5dfe06a50 (diff)
[Fix #467] Improve completion in the repl
When investigating #467 I noticed that the test checking if we're in a string or not had a mostly false positves in the repl. The previous solution relied on the parse state from point-min up to point which I think is too large a context. Furthermore, it's not reasonable to expect the entire contents of the repl buffer, prompts and all, to be valid lisp.
Diffstat (limited to 'cider-util.el')
-rw-r--r--cider-util.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/cider-util.el b/cider-util.el
index 26d8ff27..d52ea194 100644
--- a/cider-util.el
+++ b/cider-util.el
@@ -60,6 +60,14 @@ Setting this to nil removes the fontification restriction."
(file-name-directory buffer-file-name)
default-directory))
+(defun cider-in-string-p ()
+ "Return true if point is in a string."
+ (nth 3 (parse-partial-sexp (beginning-of-defun) (point))))
+
+(defun cider-in-comment-p ()
+ "Return true if point is in a comment."
+ (nth 4 (parse-partial-sexp (beginning-of-defun) (point))))
+
;;; Text properties
(defun cider-maybe-intern (name)