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

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

[elpa] externals/cape 241dde47ca 070/146: Unify cape-keyword and cape-ke


From: ELPA Syncer
Subject: [elpa] externals/cape 241dde47ca 070/146: Unify cape-keyword and cape-keyword-capf
Date: Sun, 9 Jan 2022 20:57:43 -0500 (EST)

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

    Unify cape-keyword and cape-keyword-capf
---
 cape.el | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/cape.el b/cape.el
index 6f115e48f5..e8a6f79608 100644
--- a/cape.el
+++ b/cape.el
@@ -556,23 +556,22 @@ If INTERACTIVE is nil the function acts like a capf."
 (defvar cape--keyword-properties
   (list :annotation-function (lambda (_) " Keyword")
         :company-kind (lambda (_) 'keyword))
-  "Completion extra properties for `cape-keyword-capf'.")
+  "Completion extra properties for `cape-keyword'.")
 
 ;;;###autoload
-(defun cape-keyword-capf ()
-  "Dictionary completion-at-point-function."
-  (when-let ((bounds (bounds-of-thing-at-point 'symbol))
-             (keywords (cape--keyword-table)))
-    `(,(car bounds) ,(cdr bounds) ,keywords :exclusive no 
,@cape--keyword-properties)))
-
-;;;###autoload
-(defun cape-keyword ()
-  "Complete word at point."
-  (interactive)
-  (cape--complete-thing 'symbol
-                        (or (cape--keyword-table)
-                            (user-error "No keywords for %s" major-mode))
-                        cape--keyword-properties))
+(defun cape-keyword (&optional interactive)
+  "Complete word at point.
+If INTERACTIVE is nil the function acts like a capf."
+  (interactive (list t))
+  (if interactive
+      (cape--complete-thing 'symbol
+                            (or (cape--keyword-table)
+                                (user-error "No keywords for %s" major-mode))
+                            cape--keyword-properties)
+    (when-let ((bounds (bounds-of-thing-at-point 'symbol))
+               (keywords (cape--keyword-table)))
+      `(,(car bounds) ,(cdr bounds) ,keywords
+        :exclusive no ,@cape--keyword-properties))))
 
 (defun cape--super-function (ht prop)
   "Return merged function for PROP given HT."



reply via email to

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