[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7c6d00d 32/67: ivy.el (ivy-read): Return immediately for l
From: |
Oleh Krehel |
Subject: |
[elpa] master 7c6d00d 32/67: ivy.el (ivy-read): Return immediately for less than 2 candidates |
Date: |
Sun, 22 Mar 2015 17:33:59 +0000 |
branch: master
commit 7c6d00d2893dcd41bd60e7f1786a56d4cf151d01
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-read): Return immediately for less than 2 candidates
---
ivy.el | 40 ++++++++++++++++++++++------------------
1 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/ivy.el b/ivy.el
index 8a6432d..462067e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -124,24 +124,28 @@ COLLECTION is a list of strings.
If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
UPDATE-FN is called each time the current candidate(s) is changed.
If INDEX is non-nil select the corresponding candidate."
- (setq ivy--index (or index 0))
- (setq ivy--old-re nil)
- (setq ivy--old-cands nil)
- (setq ivy-text "")
- (setq ivy--all-candidates collection)
- (setq ivy--update-fn update-fn)
- (setq ivy-exit nil)
- (setq ivy--default (or (thing-at-point 'symbol) ""))
- (unwind-protect
- (minibuffer-with-setup-hook
- #'ivy--minibuffer-setup
- (read-from-minibuffer
- prompt
- initial-input
- ivy-minibuffer-map
- nil
- 'ivy-history))
- (remove-hook 'post-command-hook #'ivy--exhibit)))
+ (cl-case (length collection)
+ (0 nil)
+ (1 (car collection))
+ (t
+ (setq ivy--index (or index 0))
+ (setq ivy--old-re nil)
+ (setq ivy--old-cands nil)
+ (setq ivy-text "")
+ (setq ivy--all-candidates collection)
+ (setq ivy--update-fn update-fn)
+ (setq ivy-exit nil)
+ (setq ivy--default (or (thing-at-point 'symbol) ""))
+ (unwind-protect
+ (minibuffer-with-setup-hook
+ #'ivy--minibuffer-setup
+ (read-from-minibuffer
+ prompt
+ initial-input
+ ivy-minibuffer-map
+ nil
+ 'ivy-history))
+ (remove-hook 'post-command-hook #'ivy--exhibit)))))
(defvar ivy-text ""
"Stores the user's string as it is typed in.")
- [elpa] master 6a874a4 11/67: Add `ivy' back end, (continued)
- [elpa] master 6a874a4 11/67: Add `ivy' back end, Oleh Krehel, 2015/03/22
- [elpa] master f268cc8 21/67: Reveal invisible overlays, Oleh Krehel, 2015/03/22
- [elpa] master 835208a 20/67: Inherit standard faces by default, Oleh Krehel, 2015/03/22
- [elpa] master f148a94 24/67: Fix use of cl-incf, Oleh Krehel, 2015/03/22
- [elpa] master 2ed9ee2 23/67: Require delsel for `minibuffer-keyboard-quit', Oleh Krehel, 2015/03/22
- [elpa] master 1ca1660 22/67: swiper.el: Save position before last search, Oleh Krehel, 2015/03/22
- [elpa] master 02ca7a1 25/67: Add anchoring, Oleh Krehel, 2015/03/22
- [elpa] master b1ac649 26/67: Don't recenter unless necessary, Oleh Krehel, 2015/03/22
- [elpa] master a07c2e4 27/67: swiper.el: Make ivy the default back end, Oleh Krehel, 2015/03/22
- [elpa] master baa9df7 30/67: Truncate candidates to window width in the minibuffer, Oleh Krehel, 2015/03/22
- [elpa] master 7c6d00d 32/67: ivy.el (ivy-read): Return immediately for less than 2 candidates,
Oleh Krehel <=
- [elpa] master 315be36 31/67: counsel.el: Add, Oleh Krehel, 2015/03/22
- [elpa] master 0772929 29/67: Add some rudimentary history handling, Oleh Krehel, 2015/03/22
- [elpa] master 045fb60 28/67: ivy.el (ivy-previous-line): Change to `cl-decf', Oleh Krehel, 2015/03/22
- [elpa] master e1cdb29 37/67: counsel.el: Add Clojure completion at point, Oleh Krehel, 2015/03/22
- [elpa] master 7ff3dd9 35/67: Need to check value of variable, Oleh Krehel, 2015/03/22
- [elpa] master c78cc15 34/67: swiper.el: Clean up overlays better on "C-g", Oleh Krehel, 2015/03/22
- [elpa] master e7b560c 38/67: swiper.el (swiper--opoint): Fix bad defvar, Oleh Krehel, 2015/03/22
- [elpa] master d78caee 33/67: Open invisible overlays using isearch, Oleh Krehel, 2015/03/22
- [elpa] master 8818a01 36/67: swiper.el: Fix error for empty buffer, Oleh Krehel, 2015/03/22
- [elpa] master 984346c 40/67: swiper.el (swiper-font-lock-ensure): Exclude a few modes, Oleh Krehel, 2015/03/22