[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 988b78f 08/31: Improve completion history using the proper
From: |
Oleh Krehel |
Subject: |
[elpa] master 988b78f 08/31: Improve completion history using the propertize trick |
Date: |
Fri, 01 May 2015 14:28:45 +0000 |
branch: master
commit 988b78fd43b017220c4a440bddfa1efe9436ffe2
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Improve completion history using the propertize trick
* ivy.el (ivy-previous-history-element): Update.
(ivy-next-history-element): Update.
(ivy--maybe-scroll-history): New defun. When the history element string
has ivy-index property, set `ivy--index' to that.
Fixes #46
---
ivy.el | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/ivy.el b/ivy.el
index 7b38d65..2fae5e1 100644
--- a/ivy.el
+++ b/ivy.el
@@ -323,13 +323,25 @@ If the input is empty, select the previous history
element instead."
"Forward to `previous-history-element' with ARG."
(interactive "p")
(previous-history-element arg)
- (move-end-of-line 1))
+ (move-end-of-line 1)
+ (ivy--maybe-scroll-history))
(defun ivy-next-history-element (arg)
"Forward to `next-history-element' with ARG."
(interactive "p")
(next-history-element arg)
- (move-end-of-line 1))
+ (move-end-of-line 1)
+ (ivy--maybe-scroll-history))
+
+(defun ivy--maybe-scroll-history ()
+ "If the selected history element holds an index, scroll there."
+ (let ((idx (ignore-errors
+ (get-text-property
+ (minibuffer-prompt-end)
+ 'ivy-index))))
+ (when idx
+ (ivy--exhibit)
+ (setq ivy--index idx))))
(defun ivy--cd (dir)
"When completing file names, move to directory DIR."
@@ -539,7 +551,7 @@ When SORT is t, refer to `ivy-sort-functions-alist' for
sorting."
nil
hist)))
(when (eq ivy-exit 'done)
- (set hist (cons ivy-text
+ (set hist (cons (propertize ivy-text 'ivy-index ivy--index)
(delete ivy-text
(cdr (symbol-value hist)))))
res)))
- [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, 2015/05/01
- [elpa] master 988b78f 08/31: Improve completion history using the propertize trick,
Oleh Krehel <=
- [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
- [elpa] master 23ffa25 19/31: Bind "TAB" to do partial completion, Oleh Krehel, 2015/05/01