branch: externals/cape
commit eaa408779e322e24992eab858062285e7d7edea9
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
cape-symbol: Implement capf
---
cape.el | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/cape.el b/cape.el
index 5671fdd956..4b63503cb7 100644
--- a/cape.el
+++ b/cape.el
@@ -402,12 +402,17 @@ If INTERACTIVE is nil the function acts like a capf."
(t 'text)))
;;;###autoload
-(defun cape-symbol ()
- "Complete symbol at point."
- (interactive)
- (cape--complete-thing 'symbol
- (cape--table-with-properties obarray :category 'symbol)
- cape--symbol-properties))
+(defun cape-symbol (&optional interactive)
+ "Complete symbol at point.
+If INTERACTIVE is nil the function acts like a capf."
+ (interactive (list t))
+ (if interactive
+ (cape--complete-thing 'symbol
+ (cape--table-with-properties obarray :category
'symbol)
+ cape--symbol-properties)
+ (when-let (bounds (bounds-of-thing-at-point 'symbol))
+ `(,(car bounds) ,(cdr bounds) ,obarray
+ :exclusive no ,@cape--symbol-properties))))
(defvar cape--dabbrev-properties
(list :annotation-function (lambda (_) " Dabbrev")