[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 373c078 2/8: company-capf: Use exit-function that came wit
From: |
Dmitry Gutov |
Subject: |
[elpa] master 373c078 2/8: company-capf: Use exit-function that came with the completion table in use |
Date: |
Sat, 8 Dec 2018 19:13:04 -0500 (EST) |
branch: master
commit 373c0789070017446c8b0b1dc115c154bfbdac53
Author: João Távora <address@hidden>
Commit: Dmitry Gutov <address@hidden>
company-capf: Use exit-function that came with the completion table in use
Before, capf-data was fetched again after the completion is inserted,
which caused problems when exit-function is a closure that references
some data dependent on the current buffer contents.
* company-capf.el (company-capf--current-completion-data): New variable.
(company-capf): Set it in `candidates'.
(company--capf-post-completion): Use it.
Closes #845.
---
company-capf.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/company-capf.el b/company-capf.el
index faac44c..9b353a7 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -34,6 +34,9 @@
(defvar company--capf-cache nil)
+(defvar company-capf--current-completion-data nil
+ "Value last returned by `company-capf' when called with `candidates'.")
+
(defun company--capf-data ()
(let ((cache company--capf-cache))
(if (and (equal (current-buffer) (car cache))
@@ -84,6 +87,7 @@
(t prefix))))))
(`candidates
(let ((res (company--capf-data)))
+ (setq company-capf--current-completion-data res)
(when res
(let* ((table (nth 3 res))
(pred (plist-get (nthcdr 4 res) :predicate))
@@ -157,7 +161,11 @@
))
(defun company--capf-post-completion (arg)
- (let* ((res (company--capf-data))
+ ;; 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))
(pred (plist-get (nthcdr 4 res) :predicate)))
- [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 <=
- [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, 2018/12/08
- [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