[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 76897c0 46/90: ivy.el (ivy-sort-functions-alist): Work for
From: |
Oleh Krehel |
Subject: |
[elpa] master 76897c0 46/90: ivy.el (ivy-sort-functions-alist): Work for commands as well |
Date: |
Tue, 30 Jun 2015 07:28:26 +0000 |
branch: master
commit 76897c0466e97d6f8d222a1d8a820543d2c303fe
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-sort-functions-alist): Work for commands as well
* ivy.el (ivy-sort-functions-alist): Examine `this-command' in addition
to the COLLECTION arg of `completing-read'. Add `Man-goto-section' and
`org-refile' to the list, since these commands collect the candidates
in the order in which they are in the buffer => the candidates must
not be sorted. Mention this in the doc.
---
ivy.el | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ivy.el b/ivy.el
index ca625cc..75953bd 100644
--- a/ivy.el
+++ b/ivy.el
@@ -594,9 +594,16 @@ Prioritize directories."
'((read-file-name-internal . ivy-sort-file-function-default)
(internal-complete-buffer . nil)
(counsel-git-grep-function . nil)
+ (Man-goto-section . nil)
+ (org-refile . nil)
(t . string-lessp))
"An alist of sorting functions for each collection function.
-For each entry, nil means no sorting.
+Interactive functions that call completion fit in here as well.
+
+For each entry, nil means no sorting. It's very useful to turn
+off the sorting for functions that have candidates in the natural
+buffer order, like `org-refile' or `Man-goto-section'.
+
The entry associated to t is used for all fall-through cases.")
(defvar ivy-re-builders-alist
@@ -835,7 +842,11 @@ The history, defaults and input-method arguments are
ignored for now."
:preselect (if (listp def) (car def) def)
:history history
:keymap nil
- :sort t))
+ :sort
+ (let ((sort (assoc this-command ivy-sort-functions-alist)))
+ (if sort
+ (cdr sort)
+ t))))
;;;###autoload
(define-minor-mode ivy-mode
- [elpa] master 7dea8b7 39/90: ivy.el (hydra-ivy/body): Autoload, (continued)
- [elpa] master 7dea8b7 39/90: ivy.el (hydra-ivy/body): Autoload, Oleh Krehel, 2015/06/30
- [elpa] master 9ceb7ee 42/90: Fix yank/undo bug, Oleh Krehel, 2015/06/30
- [elpa] master d8172a0 40/90: ivy.el (ivy--regex-fuzzy): Improve for "^" and "$", Oleh Krehel, 2015/06/30
- [elpa] master 02cedb7 43/90: ivy.el (ivy-insert-current): Add and bind to "M-i", Oleh Krehel, 2015/06/30
- [elpa] master 1a5b259 44/90: Fix the minibuffer being too small with enough candidates, Oleh Krehel, 2015/06/30
- [elpa] master e334a75 45/90: ivy.el (ivy-initial-inputs-alist): Add man and woman, Oleh Krehel, 2015/06/30
- [elpa] master ae05765 41/90: Allow to customize the initial input for all commands, Oleh Krehel, 2015/06/30
- [elpa] master 4d66758 47/90: Allow to toggle matching mode with "C-o m", Oleh Krehel, 2015/06/30
- [elpa] master 16fefbc 48/90: ivy-hydra.el (hydra-ivy): Add "C-j" and "C-m" exit points, Oleh Krehel, 2015/06/30
- [elpa] master 7945ab0 49/90: counsel.el (counsel-M-x): Call smex-rank, Oleh Krehel, 2015/06/30
- [elpa] master 76897c0 46/90: ivy.el (ivy-sort-functions-alist): Work for commands as well,
Oleh Krehel <=
- [elpa] master 61bb9e0 50/90: Require TRAMP in time, Oleh Krehel, 2015/06/30
- [elpa] master 9df660c 51/90: swiper.el (swiper-query-replace): Don't miss the first, Oleh Krehel, 2015/06/30
- [elpa] master d47dd9b 52/90: ivy-hydra.el: Improve for hydra not installed, Oleh Krehel, 2015/06/30
- [elpa] master 265f47d 53/90: Swiper should not deactivate-mark, Oleh Krehel, 2015/06/30
- [elpa] master 4cdb80c 54/90: ivy-hydra.el (defhydra): Wrap in eval-when-compile, Oleh Krehel, 2015/06/30
- [elpa] master 1dbdcdc 55/90: counsel.el (counsel-M-x): Fixup, Oleh Krehel, 2015/06/30
- [elpa] master bcc5f45 56/90: counsel.el (counsel-M-x): Fixup smex interaction, Oleh Krehel, 2015/06/30
- [elpa] master e238286 57/90: "M-n", "M-p", "M-i" should switch directories when needed, Oleh Krehel, 2015/06/30
- [elpa] master 3f41ce6 58/90: Put the file instead of partial input on history, Oleh Krehel, 2015/06/30
- [elpa] master 5e3c635 59/90: Add a set of commands for resizing minibuffer height, Oleh Krehel, 2015/06/30