Skip to content

Commit df95070

Browse files
committed
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 7d14ff5 commit df95070

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
@@ -1326,9 +1326,11 @@ you might want to use in your customization."
13261326
(save-excursion
13271327
(let ((end (point)))
13281328
(skip-chars-backward (concat "^" inf-clojure-clojure-expr-break-chars))
1329-
(let ((first-char (substring-no-properties (thing-at-point 'symbol) 0 1)))
1330-
(when (string-match-p "[^0-9]" first-char)
1331-
(cons (point) end)))))))
1329+
(let ((chars (thing-at-point 'symbol)))
1330+
(when (> (length chars) 0)
1331+
(let ((first-char (substring-no-properties chars 0 1)))
1332+
(when (string-match-p "[^0-9]" first-char)
1333+
(cons (point) end)))))))))
13321334

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

0 commit comments

Comments
 (0)