emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/inf-clojure dcb523b 191/313: Avoid computing completion bo


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure dcb523b 191/313: Avoid computing completion bounds when no valid chars are at point
Date: Wed, 11 Aug 2021 10:00:14 -0400 (EDT)

branch: elpa/inf-clojure
commit dcb523bf8bd21189e18a6751a8c2d3e1a698573d
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]