[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cape d3d9d926ac 082/146: Add cape-interactive-capf
From: |
ELPA Syncer |
Subject: |
[elpa] externals/cape d3d9d926ac 082/146: Add cape-interactive-capf |
Date: |
Sun, 9 Jan 2022 20:57:44 -0500 (EST) |
branch: externals/cape
commit d3d9d926ac7e860bd5e919f924abcd76f3fca790
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add cape-interactive-capf
---
README.org | 1 +
cape.el | 25 ++++++++++++++++---------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/README.org b/README.org
index ea7a624e04..44ca3b1770 100644
--- a/README.org
+++ b/README.org
@@ -125,4 +125,5 @@ achieve a similarly refreshing strategy.
** Other Capf transformers
- ~cape-silent-capf~: Wrap a chatty Capf and silence it.
+- ~cape-interactive-capf~: Create a Capf which can be called interactively.
- ~cape-capf-with-properties~: Add completion properties to a Capf.
diff --git a/cape.el b/cape.el
index 23140e2122..f63e6c66b4 100644
--- a/cape.el
+++ b/cape.el
@@ -316,7 +316,7 @@
"Return bounds of THING."
(or (bounds-of-thing-at-point thing) (cons (point) (point))))
-(defun cape--complete (capf)
+(defun cape--interactive (capf)
"Complete with CAPF."
(pcase (funcall capf)
(`(,beg ,end ,table . ,extra)
@@ -380,7 +380,7 @@ If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
(let (cape-file-directory-must-exist)
- (cape--complete #'cape-file))
+ (cape--interactive #'cape-file))
(let* ((bounds (cape--bounds 'filename))
(file (buffer-substring (car bounds) (cdr bounds))))
(when (or (not cape-file-directory-must-exist)
@@ -422,7 +422,7 @@ If INTERACTIVE is nil the function acts like a capf."
If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
- (cape--complete #'cape-symbol)
+ (cape--interactive #'cape-symbol)
(let ((bounds (cape--bounds 'symbol)))
`(,(car bounds) ,(cdr bounds)
,(cape--table-with-properties obarray :category 'symbol)
@@ -447,7 +447,7 @@ If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
(let ((cape-dabbrev-min-length 0))
- (cape--complete #'cape-dabbrev))
+ (cape--interactive #'cape-dabbrev))
(require 'dabbrev)
(cape--dabbrev-reset)
(let ((abbrev (ignore-errors (dabbrev--abbrev-at-point))) beg end)
@@ -498,7 +498,7 @@ If INTERACTIVE is nil the function acts like a capf."
If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
- (cape--complete #'cape-ispell)
+ (cape--interactive #'cape-ispell)
(let ((bounds (cape--bounds 'word)))
`(,(car bounds) ,(cdr bounds)
,(cape--table-with-properties
@@ -527,7 +527,7 @@ If INTERACTIVE is nil the function acts like a capf."
If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
- (cape--complete #'cape-dict)
+ (cape--interactive #'cape-dict)
(let ((bounds (cape--bounds 'word)))
`(,(car bounds) ,(cdr bounds)
,(cape--table-with-properties (cape--dict-words) :category 'cape-dict)
@@ -559,7 +559,7 @@ If INTERACTIVE is nil the function acts like a capf."
If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
- (cape--complete #'cape-abbrev)
+ (cape--interactive #'cape-abbrev)
(when-let (abbrevs (cape--abbrev-list))
(let ((bounds (cape--bounds 'symbol)))
`(,(car bounds) ,(cdr bounds)
@@ -582,7 +582,7 @@ If INTERACTIVE is nil the function acts like a capf."
If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
- (cape--complete #'cape-keyword)
+ (cape--interactive #'cape-keyword)
(when-let (keywords (cape--keyword-list))
(let ((bounds (cape--bounds 'symbol)))
`(,(car bounds) ,(cdr bounds)
@@ -745,7 +745,7 @@ VALID is the input comparator, see `cape--input-valid-p'."
If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
- (cape--complete #'cape-line)
+ (cape--interactive #'cape-line)
`(,(line-beginning-position) ,(point)
,(cape--table-with-properties (cape--line-list) :sort nil)
,@cape--line-properties)))
@@ -771,5 +771,12 @@ and the various :company-* extensions."
(cape--silent (complete-with-action action table str pred)))
,@plist)))))
+;;;###autoload
+(defun cape-interactive-capf (capf)
+ "Create interactive completion function from CAPF."
+ (lambda (&optional interactive)
+ (interactive (list t))
+ (if interactive (cape--interactive capf) (funcall capf))))
+
(provide 'cape)
;;; cape.el ends here
- [elpa] externals/cape ba85197981 075/146: Update README, (continued)
- [elpa] externals/cape ba85197981 075/146: Update README, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 202345e954 083/146: cape-capf-with-properties: Add support for :sort and :category, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 15491cef1a 087/146: Add link to Emacs, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 659f710682 089/146: Add comment, ELPA Syncer, 2022/01/09
- [elpa] externals/cape ceca3a3d06 077/146: Expand readme, ELPA Syncer, 2022/01/09
- [elpa] externals/cape c57b01e982 091/146: Improve dynamic table support of cape-super-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 7008958b02 078/146: Minor corrections, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 9e4651649b 094/146: Treat company backends as non-interruptible., ELPA Syncer, 2022/01/09
- [elpa] externals/cape c7feeee10b 080/146: Simplify, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 02c9629bc6 081/146: Refactor and simplify, ELPA Syncer, 2022/01/09
- [elpa] externals/cape d3d9d926ac 082/146: Add cape-interactive-capf,
ELPA Syncer <=
- [elpa] externals/cape 3c44bff1f6 095/146: Minor refactoring, ELPA Syncer, 2022/01/09
- [elpa] externals/cape e341f81a79 098/146: README: Add emoji example, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b06e3271e0 099/146: README: Be more precise about supported completion tables, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b612af5754 101/146: Capf query should always be interruptible, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 15279b57fa 103/146: Remove todo, ELPA Syncer, 2022/01/09
- [elpa] externals/cape dcb5a139c4 105/146: Add cape-capf-with-case-fold, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 4cd6cdd4a2 106/146: Respect ignore-case for company backends, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b8776afc9f 107/146: Add cape-dabbrev-check-other-buffers, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b52829ad6d 110/146: Add comments, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 26d6025da2 111/146: Minor adjustments, ELPA Syncer, 2022/01/09