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

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

[elpa] externals/cape eaa408779e 072/146: cape-symbol: Implement capf


From: ELPA Syncer
Subject: [elpa] externals/cape eaa408779e 072/146: cape-symbol: Implement capf
Date: Sun, 9 Jan 2022 20:57:43 -0500 (EST)

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

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



reply via email to

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