emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/cape 33850ae000 068/146: Unify cape-dict and cape-dict-


From: ELPA Syncer
Subject: [elpa] externals/cape 33850ae000 068/146: Unify cape-dict and cape-dict-capf
Date: Sun, 9 Jan 2022 20:57:43 -0500 (EST)

branch: externals/cape
commit 33850ae0007bf4959197c106609de89944e89868
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]