Skip to content

Commit dcb523b

Browse files
arichiardibbatsov
authored andcommitted
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.
1 parent d4010db commit dcb523b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

inf-clojure.el

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,9 +1352,11 @@ you might want to use in your customization."
13521352
(save-excursion
13531353
(let ((end (point)))
13541354
(skip-chars-backward (concat "^" inf-clojure-clojure-expr-break-chars))
1355-
(let ((first-char (substring-no-properties (thing-at-point 'symbol) 0 1)))
1356-
(when (string-match-p "[^0-9]" first-char)
1357-
(cons (point) end)))))))
1355+
(let ((chars (thing-at-point 'symbol)))
1356+
(when (> (length chars) 0)
1357+
(let ((first-char (substring-no-properties chars 0 1)))
1358+
(when (string-match-p "[^0-9]" first-char)
1359+
(cons (point) end)))))))))
13581360

13591361
(defun inf-clojure-completion-expr-at-point ()
13601362
"Return expression at point to complete."

0 commit comments

Comments
 (0)