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

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

[elpa] externals/company 58542350fb 2/2: company-capf--prefix: Extract


From: ELPA Syncer
Subject: [elpa] externals/company 58542350fb 2/2: company-capf--prefix: Extract
Date: Wed, 11 Sep 2024 18:57:35 -0400 (EDT)

branch: externals/company
commit 58542350fb6a949f5ed91616a715e79ee42bd8a8
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>

    company-capf--prefix: Extract
---
 company-capf.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/company-capf.el b/company-capf.el
index 9f798c7054..7ef9df0ba6 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -114,12 +114,7 @@ so we can't just use the preceding variable instead.")
   (pcase command
     (`interactive (company-begin-backend 'company-capf))
     (`prefix
-     (let ((res (company--capf-data)))
-       (when res
-         (let ((length (plist-get (nthcdr 4 res) :company-prefix-length))
-               (prefix (buffer-substring-no-properties (nth 1 res) (point)))
-               (suffix (buffer-substring-no-properties (point) (nth 2 res))))
-           (list prefix suffix length)))))
+     (company-capf--prefix))
     (`candidates
      (company-capf--candidates arg (car rest)))
     (`sorted
@@ -168,6 +163,14 @@ so we can't just use the preceding variable instead.")
      (company-capf--expand-common arg (car rest)))
     ))
 
+(defun company-capf--prefix ()
+  (let ((res (company--capf-data)))
+    (when res
+      (let ((length (plist-get (nthcdr 4 res) :company-prefix-length))
+            (prefix (buffer-substring-no-properties (nth 1 res) (point)))
+            (suffix (buffer-substring-no-properties (point) (nth 2 res))))
+        (list prefix suffix length)))))
+
 (defun company-capf--expand-common (prefix suffix)
   (let* ((data company-capf--current-completion-data)
          (table (nth 3 data))



reply via email to

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