branch: externals/cape
commit 241dde47ca9377794691c399d5d65a181e716f82
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
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."