[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 63be079 009/272: ivy.el (ivy-re-builders-alist): Allow thi
From: |
Oleh Krehel |
Subject: |
[elpa] master 63be079 009/272: ivy.el (ivy-re-builders-alist): Allow this-command to be a key |
Date: |
Mon, 25 Apr 2016 10:13:13 +0000 |
branch: master
commit 63be079bd4850aeb9eedc9d8e6b8b6bc5f514152
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-re-builders-alist): Allow this-command to be a key
* ivy.el (ivy--reset-state): Allow to specify re-builder with
`this-command'.
Example:
(defun asdf ()
(interactive)
(completing-read "prompt: " '("abc" "abcd" "def")))
(global-set-key (kbd "C-c t") 'asdf)
(setq ivy-re-builders-alist
'(
(asdf . ivy--regex-fuzzy)
(t . ivy--regex-plus)))
This is useful for commands that you didn't write. For new commands that
you write, consider using `ivy-read' and :caller.
Fixes #330
---
ivy.el | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/ivy.el b/ivy.el
index 095482f..97b601e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -996,11 +996,18 @@ selected.")
(defvar ivy-re-builders-alist
'((t . ivy--regex-plus))
"An alist of regex building functions for each collection function.
-Each function should take a string and return a valid regex or a
-regex sequence (see below).
-The entry associated with t is used for all fall-through cases.
-Possible choices: `ivy--regex', `regexp-quote', `ivy--regex-plus'.
+Each key is (in order of priority):
+1. The actual collection function, e.g. `read-file-name-internal'.
+2. The symbol passed by :caller into `ivy-read'.
+3. `this-command'.
+4. t.
+
+Each value is a function that should take a string and return a
+valid regex or a regex sequence (see below).
+
+Possible choices: `ivy--regex', `regexp-quote',
+`ivy--regex-plus', `ivy--regex-fuzzy'.
If a function returns a list, it should format like this:
'((\"matching-regexp\" . t) (\"non-matching-regexp\") ...).
@@ -1185,6 +1192,7 @@ This is useful for recursive `ivy-read'."
(cdr (assoc collection ivy-re-builders-alist)))
(and caller
(cdr (assoc caller ivy-re-builders-alist)))
+ (cdr (assoc this-command ivy-re-builders-alist))
(cdr (assoc t ivy-re-builders-alist))
'ivy--regex))
(setq ivy--subexps 0)
- [elpa] master 8306be1 006/272: Fix compilation warnings, (continued)
- [elpa] master 8306be1 006/272: Fix compilation warnings, Oleh Krehel, 2016/04/25
- [elpa] master a4317f9 002/272: ivy.el (ivy--get-window): Return a valid window, Oleh Krehel, 2016/04/25
- [elpa] master 83f89d8 003/272: Improve swiper for multiple occurrences on one line, Oleh Krehel, 2016/04/25
- [elpa] master db283d3 005/272: Fix recursive minibuffer exit with "C-g", Oleh Krehel, 2016/04/25
- [elpa] master cabab4b 012/272: swiper.el (swiper-font-lock-ensure): Add bongo-library-mode, Oleh Krehel, 2016/04/25
- [elpa] master 2c50031 004/272: Fix ivy-reverse-i-search broken by recursive update, Oleh Krehel, 2016/04/25
- [elpa] master 6951eba 001/272: Make ivy--regex-plus recognize ! at the beginning of the str, Oleh Krehel, 2016/04/25
- [elpa] master d74fab4 010/272: counsel.el (counsel-M-x): Let-bind this-command, Oleh Krehel, 2016/04/25
- [elpa] master fd27465 014/272: counsel.el (counsel-git): Fix window selection, Oleh Krehel, 2016/04/25
- [elpa] master 6bf72fd 008/272: counsel.el (counsel-imenu): Work when given positions are overlays, Oleh Krehel, 2016/04/25
- [elpa] master 63be079 009/272: ivy.el (ivy-re-builders-alist): Allow this-command to be a key,
Oleh Krehel <=
- [elpa] master 09848ca 013/272: Add cousel-ag-base-command var, Oleh Krehel, 2016/04/25
- [elpa] master adfad96 007/272: support imenu, Oleh Krehel, 2016/04/25
- [elpa] master d09a16b 011/272: swiper.el (swiper-font-lock-ensure): Add bongo-playlist-mode, Oleh Krehel, 2016/04/25
- [elpa] master a0f1e25 021/272: ivy.el (ivy-completion-in-region): Fix log 0 issue, Oleh Krehel, 2016/04/25
- [elpa] master df1dc78 019/272: counsel.el (counsel-find-file): Add initial-input, Oleh Krehel, 2016/04/25
- [elpa] master 2ea56ec 027/272: ivy.el (ivy-occur): Fix when ivy--old-re isn't a string, Oleh Krehel, 2016/04/25
- [elpa] master db3e7ff 015/272: Ensure the return result of `ivy-read', Oleh Krehel, 2016/04/25
- [elpa] master e070f4c 022/272: ivy.el (ivy-add-face-text-property): New defun, Oleh Krehel, 2016/04/25
- [elpa] master 89ed4d6 024/272: Improve flx highlighting, Oleh Krehel, 2016/04/25
- [elpa] master 09cb5c9 025/272: ivy: fix ivy--resize-minibuffer-to-fit for small delta, Oleh Krehel, 2016/04/25