[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7100925 302/348: ivy.el (ivy-completing-read-handlers-alis
From: |
Oleh Krehel |
Subject: |
[elpa] master 7100925 302/348: ivy.el (ivy-completing-read-handlers-alist): New defcustom |
Date: |
Sat, 8 Apr 2017 11:04:19 -0400 (EDT) |
branch: master
commit 7100925470283d943768c34bdd113a82c9b14cd1
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-completing-read-handlers-alist): New defcustom
Fixes #892
---
ivy.el | 68 +++++++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 38 insertions(+), 30 deletions(-)
diff --git a/ivy.el b/ivy.el
index 774a276..1e2f83d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -188,6 +188,12 @@ See
https://github.com/abo-abo/swiper/wiki/ivy-display-function."
'((ivy-completion-in-region . ivy-display-function-overlay))
"An alist for customizing `ivy-display-function'.")
+(defcustom ivy-completing-read-handlers-alist
+ '((tmm-menubar . completing-read-default)
+ (tmm-shortcut . completing-read-default))
+ "An alist of handlers to replace `completing-read' in `ivy-mode'."
+ :type '(alist :key-type function :value-type function))
+
(defvar ivy--actions-list nil
"A list of extra actions per command.")
@@ -1746,36 +1752,38 @@ INITIAL-INPUT is a string inserted into the minibuffer
initially.
HISTORY is a list of previously selected inputs.
DEF is the default value.
INHERIT-INPUT-METHOD is currently ignored."
- (if (memq this-command '(tmm-menubar tmm-shortcut))
- (completing-read-default prompt collection
- predicate require-match
- initial-input history
- def inherit-input-method)
- ;; See the doc of `completing-read'.
- (when (consp history)
- (when (numberp (cdr history))
- (setq initial-input (nth (1- (cdr history))
- (symbol-value (car history)))))
- (setq history (car history)))
- (ivy-read (replace-regexp-in-string "%" "%%" prompt)
- collection
- :predicate predicate
- :require-match require-match
- :initial-input (if (consp initial-input)
- (car initial-input)
- (if (and (stringp initial-input)
- (string-match "\\+" initial-input))
- (replace-regexp-in-string
- "\\+" "\\\\+" initial-input)
- initial-input))
- :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))))))
+ (let ((handler (assoc this-command ivy-completing-read-handlers-alist)))
+ (if handler
+ (funcall (cdr handler)
+ prompt collection
+ predicate require-match
+ initial-input history
+ def inherit-input-method)
+ ;; See the doc of `completing-read'.
+ (when (consp history)
+ (when (numberp (cdr history))
+ (setq initial-input (nth (1- (cdr history))
+ (symbol-value (car history)))))
+ (setq history (car history)))
+ (ivy-read (replace-regexp-in-string "%" "%%" prompt)
+ collection
+ :predicate predicate
+ :require-match require-match
+ :initial-input (if (consp initial-input)
+ (car initial-input)
+ (if (and (stringp initial-input)
+ (string-match "\\+" initial-input))
+ (replace-regexp-in-string
+ "\\+" "\\\\+" initial-input)
+ initial-input))
+ :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)))))))
(defvar ivy-completion-beg nil
"Completion bounds start.")
- [elpa] master 18da759 320/348: ivy.el: Remove ivy--current, (continued)
- [elpa] master 18da759 320/348: ivy.el: Remove ivy--current, Oleh Krehel, 2017/04/08
- [elpa] master 20744aa 337/348: doc/Changelog.org: Prepare for 0.9.0, Oleh Krehel, 2017/04/08
- [elpa] master 13a3f2d 342/348: doc/Changelog.org: Sort stuff, Oleh Krehel, 2017/04/08
- [elpa] master 69dfed9 146/348: counsel.el (counsel-dpkg): Remove typo, Oleh Krehel, 2017/04/08
- [elpa] master 55a90c9 152/348: Make with-ivy-window not necessary in action, Oleh Krehel, 2017/04/08
- [elpa] master 9d693ec 158/348: Use a lighter color for ivy-remote in dark themes, Oleh Krehel, 2017/04/08
- [elpa] master 9b13aa4 170/348: ivy.el (ivy-flip): Allow to flip candidates/input, Oleh Krehel, 2017/04/08
- [elpa] master 2bc1d7b 276/348: ivy.el (ivy--occur-insert-lines): Scroll to first cand, Oleh Krehel, 2017/04/08
- [elpa] master b1c6cc8 300/348: swiper.el (swiper-all): Fix case-fold-search, Oleh Krehel, 2017/04/08
- [elpa] master c3f5f28 305/348: Add circe-mode to swiper-font-lock-exclude, Oleh Krehel, 2017/04/08
- [elpa] master 7100925 302/348: ivy.el (ivy-completing-read-handlers-alist): New defcustom,
Oleh Krehel <=
- [elpa] master b894874 309/348: ivy.el (ivy-occur-grep-mode): Call wgrep-setup if available, Oleh Krehel, 2017/04/08
- [elpa] master 80d3fe3 310/348: Fix compilation warnings, Oleh Krehel, 2017/04/08
- [elpa] master b0ccc7a 312/348: README.md: Recommend enable-recursive-minibuffers, Oleh Krehel, 2017/04/08
- [elpa] master 1ac1cc1 316/348: ivy.el (ivy-completing-read): Don't require-match for null, Oleh Krehel, 2017/04/08
- [elpa] master 7ca301b 334/348: swiper.el (swiper-goto-start-of-match) New defcustom, Oleh Krehel, 2017/04/08
- [elpa] master fc2e198 335/348: swiper.el (swiper--action): Set evil search direction to forward, Oleh Krehel, 2017/04/08
- [elpa] master 718a06b 345/348: doc/Changelog.org: Fix links, Oleh Krehel, 2017/04/08
- [elpa] master 802c9da 271/348: counsel.el: Add counsel-command-history, Oleh Krehel, 2017/04/08
- [elpa] master ee91a25 283/348: ivy.el (ivy--sort-maybe): Fix byte-compiler warning, Oleh Krehel, 2017/04/08
- [elpa] master dc693c3 280/348: Make ivy--flx-sort more intelligent, Oleh Krehel, 2017/04/08