[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b2c9a20 09/31: Store the preselect and use it for empty iv
From: |
Oleh Krehel |
Subject: |
[elpa] master b2c9a20 09/31: Store the preselect and use it for empty ivy-text |
Date: |
Fri, 01 May 2015 14:28:46 +0000 |
branch: master
commit b2c9a2059718a019916b12ada80742d0a08331c4
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Store the preselect and use it for empty ivy-text
* ivy.el (ivy-def): New defvar.
(ivy-read): Store `ivy-def'.
(ivy-completing-read): Update.
(ivy--filter): When the input is empty, set `ivy--index' to select
`ivy-def'.
Fixes #64
---
ivy.el | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ivy.el b/ivy.el
index 2fae5e1..eea4016 100644
--- a/ivy.el
+++ b/ivy.el
@@ -126,6 +126,9 @@ of `history-length', which see.")
(defvar ivy-require-match t
"Store require-match. See `completing-read'.")
+(defvar ivy-def nil
+ "Store the default completion value. See `completing-read'.")
+
(defvar ivy--directory nil
"Current directory when completing file names.")
@@ -458,6 +461,7 @@ UPDATE-FN is called each time the current candidate(s) is
changed.
When SORT is t, refer to `ivy-sort-functions-alist' for sorting."
(setq ivy--directory nil)
(setq ivy-require-match require-match)
+ (setq ivy-def preselect)
(setq ivy-window (selected-window))
(setq ivy--regex-function
(or (and (functionp collection)
@@ -578,13 +582,11 @@ DEF is the default value.
_INHERIT-INPUT-METHOD is ignored for now.
The history, defaults and input-method arguments are ignored for now."
- (when (listp def)
- (setq def (car def)))
(ivy-read prompt collection
:predicate predicate
:require-match require-match
:initial-input initial-input
- :preselect def
+ :preselect (if (listp def) (car def) def)
:history history
:keymap nil
:sort t))
@@ -826,6 +828,10 @@ CANDIDATES are assumed to be static."
;; Compare with eq to handle equal duplicates in cands
(setq idx (cl-position (pop tail) cands)))
(setq ivy--index (or idx 0))))
+ (when (string= name "")
+ (setq ivy--index
+ (or (cl-position ivy-def cands :test 'equal)
+ ivy--index)))
(setq ivy--old-re re)
(setq ivy--old-cands cands)))
- [elpa] master updated (fddedd2 -> 4137447), Oleh Krehel, 2015/05/01
- [elpa] master 455bea4 01/31: ivy.el (ivy--cd): Reset `ivy--old-re', Oleh Krehel, 2015/05/01
- [elpa] master 691b12c 02/31: ivy.el (ivy-read): Fixup preselect addition, Oleh Krehel, 2015/05/01
- [elpa] master 3953b16 03/31: Respect `confirm-nonexistent-file-or-buffer', Oleh Krehel, 2015/05/01
- [elpa] master 948620f 04/31: Propertize remote buffers with ivy-remote face, Oleh Krehel, 2015/05/01
- [elpa] master e356df9 05/31: Reset to the first candidate when switching directories, Oleh Krehel, 2015/05/01
- [elpa] master 94fad10 06/31: Improve the match confirm while completing files, Oleh Krehel, 2015/05/01
- [elpa] master c816430 07/31: Minibuffer faces should inherit minibuffer-prompt, Oleh Krehel, 2015/05/01
- [elpa] master b2c9a20 09/31: Store the preselect and use it for empty ivy-text,
Oleh Krehel <=
- [elpa] master 988b78f 08/31: Improve completion history using the propertize trick, Oleh Krehel, 2015/05/01
- [elpa] master eb43e4a 10/31: ivy.el (ivy-alt-done): Treat `ivy-text' with ":" verbatim, Oleh Krehel, 2015/05/01
- [elpa] master 00810d6 11/31: ivy.el (ivy--filter): Fixup, Oleh Krehel, 2015/05/01
- [elpa] master 7f04019 12/31: swiper.el (swiper-font-lock-ensure): Exclude `elfeed-search-mode', Oleh Krehel, 2015/05/01
- [elpa] master 278870e 13/31: Use alpha compositing to add ivy-current-match face, Oleh Krehel, 2015/05/01
- [elpa] master 57de44c 14/31: Makefile: Update, Oleh Krehel, 2015/05/01
- [elpa] master 56d7802 15/31: Add an option for multi-tier regex matching, Oleh Krehel, 2015/05/01
- [elpa] master 7299950 16/31: ivy.el: Fixup docstrings, Oleh Krehel, 2015/05/01
- [elpa] master aa9d4a7 17/31: ivy.el (ivy-re-builders-alist): Improve doc, Oleh Krehel, 2015/05/01
- [elpa] master 0f141f5 18/31: counsel.el (counsel-git-grep): Add optional initial-input, Oleh Krehel, 2015/05/01