diff options
author | Lars Andersen <expez@expez.com> | 2015-09-16 10:38:14 +0200 |
---|---|---|
committer | Lars Andersen <lars.andersen@gjensidige.no> | 2015-09-18 09:17:00 +0200 |
commit | 9eedb0562f878c0903c10c1194dd7f032d20abe1 (patch) | |
tree | 41b644a1d506c0db74e1ae26d00d4c41c6376751 /cider-util.el | |
parent | 5aa4aceedf386f0792ebd67596dbfde5dfe06a50 (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.el | 8 |
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) |