[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master cf71b09 64/67: ivy.el (ivy-wrap): New defcustom
From: |
Oleh Krehel |
Subject: |
[elpa] master cf71b09 64/67: ivy.el (ivy-wrap): New defcustom |
Date: |
Sun, 22 Mar 2015 17:34:13 +0000 |
branch: master
commit cf71b096807faf61689321e770c52fe249942b74
Author: John Mastro <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-wrap): New defcustom
(ivy-next-line): Wrap around if `ivy-wrap' is non-nil
(ivy-next-line-or-history): Wrap around if `ivy-wrap' is non-nil
(ivy-previous-line): Wrap around if `ivy-wrap' is non-nil
(ivy-previous-line-or-history): Wrap around if `ivy-wrap' is non-nil
---
ivy.el | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/ivy.el b/ivy.el
index 53f86c1..2ba0b8f 100644
--- a/ivy.el
+++ b/ivy.el
@@ -55,6 +55,10 @@
Set this to nil if you don't want the count."
:type 'string)
+(defcustom ivy-wrap nil
+ "Whether to wrap around after the first and last candidate."
+ :type 'boolean)
+
;;* User Visible
;;** Keymap
(require 'delsel)
@@ -104,7 +108,9 @@ of `history-length', which see.")
(defun ivy-next-line ()
"Select the next completion candidate."
(interactive)
- (unless (>= ivy--index (1- ivy--length))
+ (if (>= ivy--index (1- ivy--length))
+ (when ivy-wrap
+ (ivy-beginning-of-buffer))
(cl-incf ivy--index)))
(defun ivy-next-line-or-history ()
@@ -113,13 +119,17 @@ If the input is empty, select the previous history
element instead."
(interactive)
(when (string= ivy-text "")
(ivy-previous-history-element 1))
- (unless (>= ivy--index (1- ivy--length))
+ (if (>= ivy--index (1- ivy--length))
+ (when ivy-wrap
+ (ivy-beginning-of-buffer))
(cl-incf ivy--index)))
(defun ivy-previous-line ()
"Select the previous completion candidate."
(interactive)
- (unless (zerop ivy--index)
+ (if (zerop ivy--index)
+ (when ivy-wrap
+ (ivy-end-of-buffer))
(cl-decf ivy--index)))
(defun ivy-previous-line-or-history ()
@@ -128,7 +138,9 @@ If the input is empty, select the previous history element
instead."
(interactive)
(when (string= ivy-text "")
(ivy-previous-history-element 1))
- (unless (zerop ivy--index)
+ (if (zerop ivy--index)
+ (when ivy-wrap
+ (ivy-end-of-buffer))
(cl-decf ivy--index)))
(defun ivy-previous-history-element (arg)
- [elpa] master 9f9c4dc 57/67: swiper-helm.el: Fix typo, (continued)
- [elpa] master 9f9c4dc 57/67: swiper-helm.el: Fix typo, Oleh Krehel, 2015/03/22
- [elpa] master 3a08a88 50/67: ivy.el (ivy-read): Change index to preselect, Oleh Krehel, 2015/03/22
- [elpa] master d2b2813 55/67: swiper-helm.el: Copy all helm stuff here, Oleh Krehel, 2015/03/22
- [elpa] master c4acef9 56/67: swiper.el: Remove the helm bits, Oleh Krehel, 2015/03/22
- [elpa] master 0c85d9a 58/67: Add a custom `ivy-count-format', Oleh Krehel, 2015/03/22
- [elpa] master c2e58e9 59/67: Fix invalid package header line, Oleh Krehel, 2015/03/22
- [elpa] master a275a2a 60/67: Use `font-lock-append-text-property' to non-destructively modify a, Oleh Krehel, 2015/03/22
- [elpa] master 7876619 61/67: Update "C-n" and "C-p" bindings, Oleh Krehel, 2015/03/22
- [elpa] master f20b287 62/67: swiper.el (swiper--init): Set `swiper--opoint', Oleh Krehel, 2015/03/22
- [elpa] master bb6c40c 63/67: swiper.el (swiper-min-highlight): New defcustom, Oleh Krehel, 2015/03/22
- [elpa] master cf71b09 64/67: ivy.el (ivy-wrap): New defcustom,
Oleh Krehel <=
- [elpa] master 55414c3 66/67: Update Copyright, Oleh Krehel, 2015/03/22
- [elpa] master 4358c03 65/67: Move swiper-helm to another repo, Oleh Krehel, 2015/03/22
- [elpa] master 302a16a 67/67: Add 'packages/swiper/' from commit '55414c321ca07bd86f0f1efaf8f6130617e6fad6', Oleh Krehel, 2015/03/22