[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c4775b6 031/348: ivy.el (ivy-action-wrap): New defcustom
From: |
Oleh Krehel |
Subject: |
[elpa] master c4775b6 031/348: ivy.el (ivy-action-wrap): New defcustom |
Date: |
Sat, 8 Apr 2017 11:03:17 -0400 (EDT) |
branch: master
commit c4775b667092d9f2e170e554007ea97397273576
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-action-wrap): New defcustom
* ivy.el (ivy-next-action): Update.
(ivy-prev-action): Update.
Fixes #516
---
ivy.el | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/ivy.el b/ivy.el
index 0ac9006..a77ee6c 100644
--- a/ivy.el
+++ b/ivy.el
@@ -860,20 +860,30 @@ If the input is empty, select the previous history
element instead."
"Return non-nil when X is a list of actions."
(and x (listp x) (not (eq (car x) 'closure))))
+(defcustom ivy-action-wrap nil
+ "When non-nil, `ivy-next-action' and `ivy-prev-action' wrap."
+ :type 'boolean)
+
(defun ivy-next-action ()
"When the current action is a list, scroll it forwards."
(interactive)
(let ((action (ivy-state-action ivy-last)))
(when (ivy--actionp action)
- (unless (>= (car action) (1- (length action)))
- (cl-incf (car action))))))
+ (let ((len (1- (length action)))
+ (idx (car action)))
+ (if (>= idx len)
+ (when ivy-action-wrap
+ (setf (car action) 1))
+ (cl-incf (car action)))))))
(defun ivy-prev-action ()
"When the current action is a list, scroll it backwards."
(interactive)
(let ((action (ivy-state-action ivy-last)))
(when (ivy--actionp action)
- (unless (<= (car action) 1)
+ (if (<= (car action) 1)
+ (when ivy-action-wrap
+ (setf (car action) (1- (length action))))
(cl-decf (car action))))))
(defun ivy-action-name ()
- [elpa] master 23d7c74 015/348: Fix previous commit, (continued)
- [elpa] master 23d7c74 015/348: Fix previous commit, Oleh Krehel, 2017/04/08
- [elpa] master 6c669ff 014/348: File sorting function using a priority order for extensions, Oleh Krehel, 2017/04/08
- [elpa] master 9407b21 021/348: swiper.el (swiper-action-recenter): New defcustom, Oleh Krehel, 2017/04/08
- [elpa] master f3690b6 019/348: Make "M-o j" consistent for ivy-switch-buffer and counsel-find-file, Oleh Krehel, 2017/04/08
- [elpa] master 79ffa67 009/348: ivy.el (ivy--filter): Recompute index after sort, Oleh Krehel, 2017/04/08
- [elpa] master c2646d4 020/348: counsel.el (counsel-load-theme-action): Update, Oleh Krehel, 2017/04/08
- [elpa] master aadc062 024/348: ivy-test.el: Add a provide statement, Oleh Krehel, 2017/04/08
- [elpa] master eba0d9e 008/348: swiper.el (swiper--ivy): Remove interactive, Oleh Krehel, 2017/04/08
- [elpa] master c20867b 022/348: ivy-hydra.el: Add package tags, Oleh Krehel, 2017/04/08
- [elpa] master 37a9629 018/348: ivy.el (ivy--reset-state): Fix ivy-resume for files, Oleh Krehel, 2017/04/08
- [elpa] master c4775b6 031/348: ivy.el (ivy-action-wrap): New defcustom,
Oleh Krehel <=
- [elpa] master ac1dc5b 034/348: counsel.el (counsel-company): New command, Oleh Krehel, 2017/04/08
- [elpa] master cba67e4 038/348: counsel.el (counsel-bookmark): Add require, Oleh Krehel, 2017/04/08
- [elpa] master 3d48093 027/348: counsel.el (counsel--gg-sentinel): Add a work around, Oleh Krehel, 2017/04/08
- [elpa] master ddb4681 025/348: counsel.el (counsel-git-grep-cmd-default): New defvar, Oleh Krehel, 2017/04/08
- [elpa] master cf38ceb 040/348: swiper.el (swiper-font-lock-exclude): Add forth-mode, Oleh Krehel, 2017/04/08
- [elpa] master ab55e03 055/348: counsel.el (counsel-set-variable): Add :preselect, Oleh Krehel, 2017/04/08
- [elpa] master f4ec789 056/348: counsel.el (counsel-set-variable): Fix 2nd preselect, Oleh Krehel, 2017/04/08
- [elpa] master 792b7b7 051/348: counsel.el (counsel-set-variable): New command, Oleh Krehel, 2017/04/08
- [elpa] master dc4a858 060/348: counsel.el (counsel-hydra-heads): New command, Oleh Krehel, 2017/04/08
- [elpa] master cd8a570 062/348: Escape `%` chars if present in the symbol value, Oleh Krehel, 2017/04/08