[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cape b4a6b63636: Add cape--wrapped-table to handle tabl
From: |
ELPA Syncer |
Subject: |
[elpa] externals/cape b4a6b63636: Add cape--wrapped-table to handle table quoting |
Date: |
Sun, 17 Jul 2022 11:57:19 -0400 (EDT) |
branch: externals/cape
commit b4a6b63636bca023e1fe2d617c26e27647955bf9
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add cape--wrapped-table to handle table quoting
---
cape.el | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/cape.el b/cape.el
index 168db09b78..24997fca65 100644
--- a/cape.el
+++ b/cape.el
@@ -113,33 +113,39 @@ The buffers are scanned for completion candidates by
`cape-line'."
(let ((completion-at-point-functions (list capf)))
(or (completion-at-point) (user-error "%s: No completions" capf))))
+(defmacro cape--wrapped-table (wrap body)
+ "Create wrapped completion table, handle `completion--unquote'.
+WRAP is the wrapper function.
+BODY is the wrapping expression."
+ (declare (indent 1))
+ `(lambda (str pred action)
+ (,@body
+ (let ((result (complete-with-action action table str pred)))
+ (when (and (eq action 'completion--unquote) (functionp (cadr result)))
+ (cl-callf ,wrap (cadr result)))
+ result))))
+
(defun cape--accept-all-table (table)
"Create completion TABLE which accepts all input."
- (lambda (str pred action)
- (or (eq action 'lambda) (complete-with-action action table str pred))))
+ (cape--wrapped-table cape--accept-all-table
+ (or (eq action 'lambda))))
(defun cape--noninterruptible-table (table)
"Create non-interruptible completion TABLE."
- (lambda (str pred action)
- (let (throw-on-input)
- (complete-with-action action table str pred))))
+ (cape--wrapped-table cape--noninterruptible-table
+ (let (throw-on-input))))
(defun cape--silent-table (table)
"Create a new completion TABLE which is silent (no messages, no errors)."
- (lambda (str pred action)
- (cape--silent
- (complete-with-action action table str pred))))
+ (cape--wrapped-table cape--silent-table
+ (cape--silent)))
(defun cape--nonessential-table (table)
"Mark completion TABLE as `non-essential'."
(let ((dir default-directory))
- (lambda (str pred action)
+ (cape--wrapped-table cape--nonessential-table
(let ((default-directory dir)
- (non-essential t))
- (let ((result (funcall table str pred action)))
- (when (and (eq action 'completion--unquote) (functionp (cadr
result)))
- (cl-callf cape--nonessential-table (cadr result)))
- result)))))
+ (non-essential t))))))
(cl-defun cape--table-with-properties (table &key category (sort t)
&allow-other-keys)
"Create completion TABLE with properties.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/cape b4a6b63636: Add cape--wrapped-table to handle table quoting,
ELPA Syncer <=