summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2021-11-28 18:00:16 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2021-11-28 18:00:16 +0100
commitdcb5a139c4372eea32f33f03f0714898864dea79 (patch)
tree0e723b7cfa5b03808c4ba7c527b8572730a8438d
parentc1f7fa746bc4d09ab10cede478e22a8a7c13c4f7 (diff)
Add cape-capf-with-case-fold
-rw-r--r--README.org1
-rw-r--r--cape.el8
2 files changed, 9 insertions, 0 deletions
diff --git a/README.org b/README.org
index 04fa175..115bbad 100644
--- a/README.org
+++ b/README.org
@@ -161,3 +161,4 @@ achieve a similarly refreshing strategy.
- ~cape-interactive-capf~: Create a Capf which can be called interactively.
- ~cape-capf-with-properties~: Add completion properties to a Capf.
- ~cape-capf-with-predicate~: Add candidate predicate to a Capf.
+- ~cape-capf-with-case-fold~: Create a Capf which is case insensitive.
diff --git a/cape.el b/cape.el
index 4a3a859..8602a35 100644
--- a/cape.el
+++ b/cape.el
@@ -861,6 +861,14 @@ The PREDICATE is passed the candidate symbol or string."
`(,beg ,end ,(cape--silent-table table) ,@plist)))))
;;;###autoload
+(defun cape-capf-with-case-fold (capf)
+ "Create a new CAPF which is case insensitive."
+ (lambda ()
+ (pcase (funcall capf)
+ (`(,beg ,end ,table . ,plist)
+ `(,beg ,end ,(completion-table-case-fold table) ,@plist)))))
+
+;;;###autoload
(defun cape-noninterruptible-capf (capf)
"Create a new CAPF which is non-interruptible silent by input."
(lambda ()