branch: externals/cape
commit 33850ae0007bf4959197c106609de89944e89868
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Unify cape-dict and cape-dict-capf
---
cape.el | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/cape.el b/cape.el
index 005c90f58b..a9c7c6bb61 100644
--- a/cape.el
+++ b/cape.el
@@ -502,20 +502,16 @@ If INTERACTIVE is nil the function acts like a capf."
:category 'cape-dict))))
;;;###autoload
-(defun cape-dict-capf ()
- "Dictionary completion-at-point-function."
- (when-let (bounds (bounds-of-thing-at-point 'word))
- `(,(car bounds) ,(cdr bounds)
- ,(lambda (str pred action)
- ;; Load the dict lazily
- (complete-with-action action (cape--dict-table) str pred))
- :exclusive no ,@cape--dict-properties)))
-
-;;;###autoload
-(defun cape-dict ()
- "Complete word at point."
- (interactive)
- (cape--complete-thing 'word (cape--dict-table) cape--dict-properties))
+(defun cape-dict (&optional interactive)
+ "Complete word at point.
+If INTERACTIVE is nil the function acts like a capf."
+ (interactive (list t))
+ (if interactive
+ (cape--complete-thing 'word (cape--dict-table) cape--dict-properties)
+ (when-let (bounds (bounds-of-thing-at-point 'word))
+ `(,(car bounds) ,(cdr bounds)
+ ,(cape--dict-table)
+ :exclusive no ,@cape--dict-properties))))
(defun cape--abbrev-table ()
"Abbreviation completion table."