[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 90aaf8b 307/348: ivy.el (ivy-completing-read): Set :caller
From: |
Oleh Krehel |
Subject: |
[elpa] master 90aaf8b 307/348: ivy.el (ivy-completing-read): Set :caller to this-command |
Date: |
Sat, 8 Apr 2017 11:04:20 -0400 (EDT) |
branch: master
commit 90aaf8bfa1d02e647548076b693d99beb21ffd94
Author: Torsten Marek <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-completing-read): Set :caller to this-command
Fix a bug with custom sorting functions when ivy-read is called from
ivy-completing-read.
When calling ivy-read from ivy-completing-read, always pass in :sort t
and :caller this-command. In ivy--reset-state, look up the sorting
function using caller.
Fixes #899
---
ivy.el | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/ivy.el b/ivy.el
index 1e2f83d..92699f0 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1283,8 +1283,7 @@ See also `ivy-sort-max-size'."
(defun ivy--sort-function (collection)
"Retrieve sort function from `ivy-sort-functions-alist'"
- (let ((res (cdr (assoc collection ivy-sort-functions-alist))))
- (or (car-safe res) res)))
+ (cdr (assoc collection ivy-sort-functions-alist)))
(defun ivy-rotate-sort ()
"Rotate through sorting functions available for current collection.
@@ -1666,10 +1665,10 @@ This is useful for recursive `ivy-read'."
(setq sort-fn (ivy--sort-function collection)))
(when (not (eq collection 'read-file-name-internal))
(setq coll (cl-sort coll sort-fn)))
- (unless (eq history 'org-refile-history)
- (if (and (setq sort-fn (ivy--sort-function t))
- (<= (length coll) ivy-sort-max-size))
- (setq coll (cl-sort (copy-sequence coll) sort-fn))))))
+ (when (and (not (eq history 'org-refile-history))
+ (<= (length coll) ivy-sort-max-size)
+ (setq sort-fn (ivy--sort-function caller)))
+ (setq coll (cl-sort (copy-sequence coll) sort-fn)))))
(setq coll (ivy--set-candidates coll))
(when preselect
(unless (or (not (stringp preselect))
@@ -1779,11 +1778,8 @@ INHERIT-INPUT-METHOD is currently ignored."
:preselect (if (listp def) (car def) def)
:history history
:keymap nil
- :sort
- (let ((sort (assoc this-command ivy-sort-functions-alist)))
- (if sort
- (ivy--sort-function (car sort))
- (or (ivy--sort-function t) t)))))))
+ :sort t
+ :caller this-command))))
(defvar ivy-completion-beg nil
"Completion bounds start.")
- [elpa] master 039c58a 254/348: counsel.el: added three new counsel commands., (continued)
- [elpa] master 039c58a 254/348: counsel.el: added three new counsel commands., Oleh Krehel, 2017/04/08
- [elpa] master 5b66c18 267/348: Update copyright year, Oleh Krehel, 2017/04/08
- [elpa] master 1870f41 272/348: counsel.el: Fix counsel-command-history, Oleh Krehel, 2017/04/08
- [elpa] master c2b0d30 284/348: Add missing parameter for ag, Oleh Krehel, 2017/04/08
- [elpa] master 58372db 281/348: Add command `counsel-mark-ring', Oleh Krehel, 2017/04/08
- [elpa] master 5f732cd 297/348: Add compatibility with evil-ex-search., Oleh Krehel, 2017/04/08
- [elpa] master d23d1fe 296/348: swiper.el (swiper-font-lock-exclude): Add nix-mode, Oleh Krehel, 2017/04/08
- [elpa] master 4dcd315 292/348: counsel.el: Improve counsel-package, Oleh Krehel, 2017/04/08
- [elpa] master 2b8d324 299/348: counsel.el (counsel-org-tag-action): Fix "C-M-m", Oleh Krehel, 2017/04/08
- [elpa] master c5fa8c2 308/348: Run wgrep-setup when entering ivy-occur-grep-mode, Oleh Krehel, 2017/04/08
- [elpa] master 90aaf8b 307/348: ivy.el (ivy-completing-read): Set :caller to this-command,
Oleh Krehel <=
- [elpa] master e9219e7 313/348: ivy-hydra.el: Use ivy-minibuffer-map, Oleh Krehel, 2017/04/08
- [elpa] master 7f5b268 311/348: ivy-hydra.el: Add an alternative "M-o" using hydra, Oleh Krehel, 2017/04/08
- [elpa] master beffa78 323/348: counsel.el (counsel-grep-base-command): Single quote regex, Oleh Krehel, 2017/04/08
- [elpa] master 7b453c8 329/348: ivy.el (ivy-completion-in-region-action): Work for cons cells, Oleh Krehel, 2017/04/08
- [elpa] master 1e739de 331/348: ivy-overlay.el (ivy-left-pad): Trim cands to window-width, Oleh Krehel, 2017/04/08
- [elpa] master 16b002a 343/348: doc/Changelog.org: Link all issues, Oleh Krehel, 2017/04/08
- [elpa] master e1351c8 348/348: Merge commit 'ace01d5603ddf49b025eb811b612af72ec38dcfb' from swiper, Oleh Krehel, 2017/04/08
- [elpa] master 3ce73ce 069/348: counsel.el (counsel-company): Enable company-mode, Oleh Krehel, 2017/04/08
- [elpa] master 61cdcd5 139/348: ivy.el (ivy-occur-press-and-switch): Use ivy-occur-last, Oleh Krehel, 2017/04/08
- [elpa] master 9346e96 194/348: Improve the overlay offset, Oleh Krehel, 2017/04/08