[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6ae91f7 213/272: Make ivy-set-sources work also for sync c
From: |
Oleh Krehel |
Subject: |
[elpa] master 6ae91f7 213/272: Make ivy-set-sources work also for sync completion |
Date: |
Mon, 25 Apr 2016 10:13:26 +0000 |
branch: master
commit 6ae91f76f4ac653eaecc3765b917bbd181ef3f0d
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Make ivy-set-sources work also for sync completion
Here's a contrived example of how to use it:
(defun my-extra-source ()
(append
(when (eq 'Git (vc-backend (buffer-file-name)))
(list "git1" "git2" "git3"))
(when (file-exists-p "doc/Changelog.org")
(list (propertize "doc/Changelog.org" 'face '(:background
"red"))))))
(defun my-find-file ()
(interactive)
(ivy-read "Find file: " 'read-file-name-internal
:action (lambda (x)
(with-ivy-window
(find-file (expand-file-name x
ivy--directory))))
:require-match 'confirm-after-completion
:history 'file-name-history
:caller 'my-find-file))
(ivy-set-sources
'my-find-file
'((my-extra-source)
(original-source)))
The function `my-find-file' knows nothing about the extra source, it's
only purpose is to introduce a :caller to attach things to, as to not to
mess up e.g. `counsel-find-file'.
The function `my-extra-source' gets called once in `ivy-read' via
`ivy--reset-state'. It takes no args and returns a list of strings,
possibly empty.
---
ivy.el | 1 +
1 file changed, 1 insertion(+)
diff --git a/ivy.el b/ivy.el
index bd5e276..964a947 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1429,6 +1429,7 @@ This is useful for recursive `ivy-read'."
(if (and (setq sort-fn (cdr (assoc t ivy-sort-functions-alist)))
(<= (length coll) ivy-sort-max-size))
(setq coll (cl-sort (copy-sequence coll) sort-fn))))))
+ (setq coll (ivy--set-candidates coll))
(when preselect
(unless (or (and require-match
(not (eq collection 'internal-complete-buffer)))
- [elpa] master 48b5638 129/272: ivy.el (ivy-next-history-element): Don't add symbol bounds for file names, (continued)
- [elpa] master 48b5638 129/272: ivy.el (ivy-next-history-element): Don't add symbol bounds for file names, Oleh Krehel, 2016/04/25
- [elpa] master 41dfae6 194/272: ivy.el (ivy--format-function-generic): Fix doc, Oleh Krehel, 2016/04/25
- [elpa] master f0de338 198/272: ivy.el (ivy--directory-done): Fix when ivy-text is a dir, Oleh Krehel, 2016/04/25
- [elpa] master 67224c0 171/272: counsel.el (counsel-prompt-function): New defcustom, Oleh Krehel, 2016/04/25
- [elpa] master 0c5f68c 183/272: counsel.el (counsel-pt): Add, Oleh Krehel, 2016/04/25
- [elpa] master 692002d 184/272: counsel.el (counsel-pt): Remove unused args, Oleh Krehel, 2016/04/25
- [elpa] master 0bad922 083/272: Provide the :caller in most calls to ivy-read, Oleh Krehel, 2016/04/25
- [elpa] master dabd1f8 205/272: ivy.el (ivy-avy): Make "C-g" cancel gracefully, Oleh Krehel, 2016/04/25
- [elpa] master e8f2064 117/272: Rename counsel-symbol-at-point to ivy-thing-at-point, Oleh Krehel, 2016/04/25
- [elpa] master 8d04638 202/272: counsel.el: Fix breakage due to helm-rhythmbox, Oleh Krehel, 2016/04/25
- [elpa] master 6ae91f7 213/272: Make ivy-set-sources work also for sync completion,
Oleh Krehel <=
- [elpa] master f7c7114 037/272: ivy-test.el (ivy--regex-ignore-order): New test, Oleh Krehel, 2016/04/25
- [elpa] master 1088078 266/272: When selecting a non-existing key in an alist, return that key, Oleh Krehel, 2016/04/25
- [elpa] master 341b5a2 229/272: counsel-grep should pick candidates closest to point, Oleh Krehel, 2016/04/25
- [elpa] master d71b5c5 081/272: swiper.el (swiper--action): Update regexp-search-ring, Oleh Krehel, 2016/04/25
- [elpa] master e1c156b 074/272: ivy.el (ivy--resize-minibuffer-to-fit): Check frame-root-window-p, Oleh Krehel, 2016/04/25
- [elpa] master ebd3e29 089/272: swiper.el (swiper--update-input-ivy): Fix a bug, Oleh Krehel, 2016/04/25
- [elpa] master de0e541 234/272: Speed up counsel-grep by up to 40 times, Oleh Krehel, 2016/04/25
- [elpa] master 299bc13 097/272: Fix initial-input not set to nil for 'read-file-name-internal, Oleh Krehel, 2016/04/25
- [elpa] master bab5aab 269/272: doc/Changelog.org: Prepare for the 0.8.0 release, Oleh Krehel, 2016/04/25
- [elpa] master 0efbf6e 055/272: Simplify the signature for :dynamic-collection functions, Oleh Krehel, 2016/04/25