[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5ed4918 3/8: Use company-capf--current-completion-data in
From: |
Dmitry Gutov |
Subject: |
[elpa] master 5ed4918 3/8: Use company-capf--current-completion-data in more places |
Date: |
Sat, 8 Dec 2018 19:13:04 -0500 (EST) |
branch: master
commit 5ed4918484e9d6de80fffea63afdc1f8b8f1b32b
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Use company-capf--current-completion-data in more places
#845
---
company-capf.el | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/company-capf.el b/company-capf.el
index 9b353a7..979f80b 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -34,8 +34,12 @@
(defvar company--capf-cache nil)
+;; FIXME: Provide a way to save this info once in Company itself
+;; (https://github.com/company-mode/company-mode/pull/845).
(defvar company-capf--current-completion-data nil
- "Value last returned by `company-capf' when called with `candidates'.")
+ "Value last returned by `company-capf' when called with `candidates'.
+For most properties/actions, this is just what we need: the exact values
+that accompanied the completion table that's currently is use.")
(defun company--capf-data ()
(let ((cache company--capf-cache))
@@ -109,7 +113,7 @@
candidates))
candidates)))))
(`sorted
- (let ((res (company--capf-data)))
+ (let ((res company-capf--current-completion-data))
(when res
(let ((meta (completion-metadata
(buffer-substring (nth 1 res) (nth 2 res))
@@ -118,7 +122,8 @@
(`match
;; Ask the for the `:company-match' function. If that doesn't help,
;; fallback to sniffing for face changes to get a suitable value.
- (let ((f (plist-get (nthcdr 4 (company--capf-data)) :company-match)))
+ (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
+ :company-match)))
(if f (funcall f arg)
(let* ((match-start nil) (pos -1)
(prop-value nil) (faces nil)
@@ -142,16 +147,20 @@
(`no-cache t) ;Not much can be done here, as long as we handle
;non-prefix matches.
(`meta
- (let ((f (plist-get (nthcdr 4 (company--capf-data)) :company-docsig)))
+ (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
+ :company-docsig)))
(when f (funcall f arg))))
(`doc-buffer
- (let ((f (plist-get (nthcdr 4 (company--capf-data)) :company-doc-buffer)))
+ (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
+ :company-doc-buffer)))
(when f (funcall f arg))))
(`location
- (let ((f (plist-get (nthcdr 4 (company--capf-data)) :company-location)))
+ (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
+ :company-location)))
(when f (funcall f arg))))
(`annotation
- (let ((f (plist-get (nthcdr 4 (company--capf-data))
:annotation-function)))
+ (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
+ :annotation-function)))
(when f (funcall f arg))))
(`require-match
(plist-get (nthcdr 4 (company--capf-data)) :company-require-match))
@@ -161,10 +170,6 @@
))
(defun company--capf-post-completion (arg)
- ;; FIXME: Note the access to `company-capf--current-completion-data' and not
- ;; `company--capf-data'. It should happen to contain just the data we need,
- ;; which includes the `:exit-function' that we got when we received the
- ;; original completion table, not the one we get when we re-call capf.
(let* ((res company-capf--current-completion-data)
(exit-function (plist-get (nthcdr 4 res) :exit-function))
(table (nth 3 res))
- [elpa] master updated (652ba99 -> cd8bbda), Dmitry Gutov, 2018/12/08
- [elpa] master 373c078 2/8: company-capf: Use exit-function that came with the completion table in use, Dmitry Gutov, 2018/12/08
- [elpa] master b37cab3 6/8: company-completion-cancelled-hook: Don't remove-hook, Dmitry Gutov, 2018/12/08
- [elpa] master 23f930b 4/8: Make company-capf--current-completion-data buffer-local, Dmitry Gutov, 2018/12/08
- [elpa] master 5ed4918 3/8: Use company-capf--current-completion-data in more places,
Dmitry Gutov <=
- [elpa] master 5adb0be 7/8: Release 0.9.8, Dmitry Gutov, 2018/12/08
- [elpa] master 0af4163 1/8: Remove an old workaround from company-capf, Dmitry Gutov, 2018/12/08
- [elpa] master cd8bbda 8/8: Merge commit '5adb0be1dfa1c9767e888eee5892a10a1f81d582' from company, Dmitry Gutov, 2018/12/08
- [elpa] master 526aa5b 5/8: Discard company-capf--current-completion-data when we can, Dmitry Gutov, 2018/12/08