[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cape d265a03e7f 074/146: cape-dabbrev: Make interactive
From: |
ELPA Syncer |
Subject: |
[elpa] externals/cape d265a03e7f 074/146: cape-dabbrev: Make interactive |
Date: |
Sun, 9 Jan 2022 20:57:44 -0500 (EST) |
branch: externals/cape
commit d265a03e7f658fe8a94a20037dd9779fe8a18e29
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
cape-dabbrev: Make interactive
---
cape.el | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/cape.el b/cape.el
index 3aac50e3cb..1ba8d46986 100644
--- a/cape.el
+++ b/cape.el
@@ -417,7 +417,7 @@ If INTERACTIVE is nil the function acts like a capf."
(defvar cape--dabbrev-properties
(list :annotation-function (lambda (_) " Dabbrev")
:company-kind (lambda (_) 'text))
- "Completion extra properties for `cape-dabbrev-capf'.")
+ "Completion extra properties for `cape-dabbrev'.")
(defvar dabbrev-check-all-buffers)
(defvar dabbrev-check-other-buffers)
@@ -427,20 +427,31 @@ If INTERACTIVE is nil the function acts like a capf."
(declare-function dabbrev--abbrev-at-point "dabbrev")
;;;###autoload
-(defun cape-dabbrev-capf ()
- "Ispell completion-at-point-function."
+(defun cape-dabbrev (&optional interactive)
+ "Complete with Dabbrev at point.
+If INTERACTIVE is nil the function acts like a capf."
+ (interactive (list t))
(require 'dabbrev)
(cape--dabbrev-reset)
- (let ((abbrev (ignore-errors (dabbrev--abbrev-at-point))))
- (when (and abbrev (not (string-match-p "\\s-" abbrev)))
- (let ((beg (progn (search-backward abbrev) (point)))
- (end (progn (search-forward abbrev) (point))))
- `(,beg ,end
- ;; Use equal check, since candidates must be longer than
cape-dabbrev-min-length
- ,(cape--cached-table beg end #'cape--dabbrev-expansions
- :valid 'equal :category 'cape-dabbrev)
- :exclusive no
- ,@cape--dabbrev-properties)))))
+ (let ((abbrev (ignore-errors (dabbrev--abbrev-at-point))) beg end)
+ (cond
+ ((and abbrev (not (string-match-p "\\s-" abbrev)))
+ (save-excursion
+ (search-backward abbrev)
+ (setq beg (point))
+ (search-forward abbrev)
+ (setq end (point)))
+ (if interactive
+ (cape--complete beg end (cape--dabbrev-table beg end)
cape--dabbrev-properties)
+ `(,beg ,end ,(cape--dabbrev-table beg end)
+ :exclusive no ,@cape--dabbrev-properties)))
+ (interactive (user-error "No expansion")))))
+
+(defun cape--dabbrev-table (beg end)
+ "Dabbrev completion table for string between BEG and END."
+ ;; Use equal check, since candidates must be longer than
cape-dabbrev-min-length
+ (cape--cached-table beg end #'cape--dabbrev-expansions
+ :valid 'equal :category 'cape-dabbrev))
(defun cape--dabbrev-reset ()
"Reset dabbrev state."
- [elpa] externals/cape 6ff72e5253 067/146: Unify cape-ispell and cape-ispell-capf, (continued)
- [elpa] externals/cape 6ff72e5253 067/146: Unify cape-ispell and cape-ispell-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape d3e4d152ac 024/146: Add cape-symbol, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 8036636a0f 026/146: Add comment, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 9bd7bed258 029/146: cape-company-capf: Call the backend later in the completion process, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 67c3b75e2a 039/146: Refactor dabbrev, simplify, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 6e525cdfdd 040/146: Rework cape-company-to-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 6deb7d7a8b 044/146: Add docstrings, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 3ad6aa105e 045/146: cape-company-to-capf: Simplify, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 4a1f19af23 057/146: Fix super capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 26401bfa6a 069/146: Unify cape-abbrev and cape-abbrev-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape d265a03e7f 074/146: cape-dabbrev: Make interactive,
ELPA Syncer <=
- [elpa] externals/cape 3eb7efc2d4 050/146: README: Expand reasoning, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 8cf2942881 085/146: Add comments regarding interruptible completion tables, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 488cfd9ed7 086/146: Move code around, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 2008d809b6 088/146: Add cape-capf-with-predicate, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 4b424150ef 090/146: cape-super-capf: Delete duplicates (Fix #13), ELPA Syncer, 2022/01/09
- [elpa] externals/cape da32e232d6 093/146: cape--company-call: Cheaper timeout checking, throw error, ELPA Syncer, 2022/01/09
- [elpa] externals/cape c4d821d55b 079/146: Add cape--symbol-annotation, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 2ce63259d7 097/146: Update README - Asynchronous Company backends work as expected, ELPA Syncer, 2022/01/09
- [elpa] externals/cape c1f7fa746b 104/146: Improve synchronization, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 1d69a06890 117/146: cape-tex/cape-sgml: Add autoloads, ELPA Syncer, 2022/01/09