[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cape 63ded5fde4 028/146: Improve cape-company-to-capf
From: |
ELPA Syncer |
Subject: |
[elpa] externals/cape 63ded5fde4 028/146: Improve cape-company-to-capf |
Date: |
Sun, 9 Jan 2022 20:57:39 -0500 (EST) |
branch: externals/cape
commit 63ded5fde48cdae116ec4d09f8482fc3bbbd3c10
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Improve cape-company-to-capf
---
cape.el | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/cape.el b/cape.el
index 07e751de2d..51904b5a69 100644
--- a/cape.el
+++ b/cape.el
@@ -573,28 +573,27 @@ This feature is experimental."
;; future is returned, the capf should fail first. As soon as
the future
;; callback is called, remember the result, refresh the UI and
return the
;; remembered result the next time the capf is called.
- (let ((no-cache (cape--company-call backend 'no-cache input))
- (dups (if (cape--company-call backend 'duplicates)
#'delete-dups #'identity))
- (candidates nil)
- (metadata `(metadata (category . ,backend))))
+ (let* ((no-cache (cape--company-call backend 'no-cache input))
+ (dups (if (cape--company-call backend 'duplicates)
#'delete-dups #'identity))
+ (candidates (funcall dups (cape--company-call backend
'candidates input)))
+ (metadata `(metadata (category . ,backend)))
+ (beg (copy-marker (- (point) (length input))))
+ (end (copy-marker (point) t)))
(when (cape--company-call backend 'sorted)
(nconc metadata '((display-sort-function . identity)
(cycle-sort-function . identity))))
- (list (- (point) (length input)) (point)
+ (list beg end
(lambda (str pred action)
(if (eq action 'metadata)
metadata
- (complete-with-action
- action
- ;; TODO It is not clear which prefix to use here.
- ;; Either use `str' (but this is affected by the
completion style),
- ;; or request a new prefix from the backend and
use that?
- (if no-cache
- (funcall dups (cape--company-call backend
'candidates input))
- (or candidates
- (setq candidates
- (funcall dups (cape--company-call
backend 'candidates input)))))
- str pred)))
+ (when no-cache
+ ;; Use current input string as prefix (before
spaces)
+ (let ((new-input (replace-regexp-in-string
+ "\\s-.*" ""
(buffer-substring-no-properties beg end))))
+ (unless (equal new-input input)
+ (setq input new-input
+ candidates (funcall dups
(cape--company-call backend 'candidates input))))))
+ (complete-with-action action candidates str pred)))
:exclusive 'no
:company-prefix-length (cdr-safe prefix)
:company-doc-buffer (lambda (x) (cape--company-call
backend 'doc-buffer x))
- [elpa] externals/cape 4b3f29e565 001/146: Initial commit, (continued)
- [elpa] externals/cape 4b3f29e565 001/146: Initial commit, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 139ffe8720 002/146: Add license, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 8ed1e4e9cd 005/146: Remove parens from annotations, ELPA Syncer, 2022/01/09
- [elpa] externals/cape a8d00aa3ef 006/146: Add defcustoms, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 97eacd933d 016/146: README: Update example, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 9833045077 017/146: Add completion categories, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b3c5e4ec69 018/146: cape-merge-capfs: Fix sorting, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 26b822db0a 011/146: Add MELPA badges, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 84c128ae9b 013/146: Add cape-merge-capfs (Fix #2), ELPA Syncer, 2022/01/09
- [elpa] externals/cape 6c124b6cfd 015/146: README: Add some justification for the name :), ELPA Syncer, 2022/01/09
- [elpa] externals/cape 63ded5fde4 028/146: Improve cape-company-to-capf,
ELPA Syncer <=
- [elpa] externals/cape f270456b5d 041/146: Improve cape-dabbrev-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape a8e10cf7ae 014/146: Update README, ELPA Syncer, 2022/01/09
- [elpa] externals/cape d6b13d3055 027/146: Fix no-cache call, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 0e60999893 032/146: cape-ispell: Fix caching, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 7325c5002f 035/146: Update README, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 0a374042c9 003/146: README: Update configuration, ELPA Syncer, 2022/01/09
- [elpa] externals/cape d7c765d057 004/146: Add cape-keyword and cape-keyword-capf (Fix #3), ELPA Syncer, 2022/01/09
- [elpa] externals/cape 1aaca0fd74 008/146: Expand comment, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 38802ada22 007/146: Add kinds, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b1f57d79ba 009/146: Improve ispell, ELPA Syncer, 2022/01/09