branch: elpa/inf-clojure commit dcb523bf8bd21189e18a6751a8c2d3e1a698573d Author: Andrea Richiardi <a.richiardi.w...@gmail.com> Commit: Bozhidar Batsov <bozhidar.bat...@gmail.com>
Avoid computing completion bounds when no valid chars are at point For instance we want to avoid using substring-no-properties while typing ^| (where | is point) because it will error out. --- inf-clojure.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inf-clojure.el b/inf-clojure.el index 8c5befd..127ff9c 100644 --- a/inf-clojure.el +++ b/inf-clojure.el @@ -1352,9 +1352,11 @@ you might want to use in your customization." (save-excursion (let ((end (point))) (skip-chars-backward (concat "^" inf-clojure-clojure-expr-break-chars)) - (let ((first-char (substring-no-properties (thing-at-point 'symbol) 0 1))) - (when (string-match-p "[^0-9]" first-char) - (cons (point) end))))))) + (let ((chars (thing-at-point 'symbol))) + (when (> (length chars) 0) + (let ((first-char (substring-no-properties chars 0 1))) + (when (string-match-p "[^0-9]" first-char) + (cons (point) end))))))))) (defun inf-clojure-completion-expr-at-point () "Return expression at point to complete."