[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 0091c8a 058/348: ivy.el (ivy-set-prompt-text-properties-fu
From: |
Oleh Krehel |
Subject: |
[elpa] master 0091c8a 058/348: ivy.el (ivy-set-prompt-text-properties-function): New devar |
Date: |
Sat, 8 Apr 2017 11:03:24 -0400 (EDT) |
branch: master
commit 0091c8a5475f16a549996e3eef7b6f3b504e1e28
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-set-prompt-text-properties-function): New devar
* ivy.el (ivy-set-prompt-text-properties-default): New defun.
Fixes #545.
Notes:
- User-facing variables should preferably be without `--', hence the
rename from `ivy--prompt-text-prop-override-function' to
`ivy-set-prompt-text-properties-function'.
- Using the (defvar foo-function 'foo-function-default) pattern is a
simple and easy-to-debug and customize approach.
---
ivy.el | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/ivy.el b/ivy.el
index 093ae1b..b661a6d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1920,17 +1920,19 @@ depending on the number of candidates."
(goto-char (minibuffer-prompt-end))
(delete-region (line-end-position) (point-max))))
-(defvar ivy--prompt-text-prop-override-function
- (lambda (prompt std-props)
- (ivy--set-match-props prompt "confirm"
- `(face ivy-confirm-face ,@std-props))
- (ivy--set-match-props prompt "match required"
- `(face ivy-match-required-face ,@std-props))
- prompt)
- "Function to override the text properties of the default ivy prompt.
+(defvar ivy-set-prompt-text-properties-function
+ 'ivy-set-prompt-text-properties-default
+ "Function to set the text properties of the default ivy prompt.
Called with two arguments, PROMPT and STD-PROPS.
The returned value should be the updated PROMPT.")
+(defun ivy-set-prompt-text-properties-default (prompt std-props)
+ (ivy--set-match-props prompt "confirm"
+ `(face ivy-confirm-face ,@std-props))
+ (ivy--set-match-props prompt "match required"
+ `(face ivy-match-required-face ,@std-props))
+ prompt)
+
(defun ivy--insert-prompt ()
"Update the prompt according to `ivy--prompt'."
(when ivy--prompt
@@ -1984,7 +1986,7 @@ The returned value should be the updated PROMPT.")
(set-text-properties 0 (length n-str)
`(face minibuffer-prompt ,@std-props)
n-str)
- (setq n-str (funcall ivy--prompt-text-prop-override-function
+ (setq n-str (funcall ivy-set-prompt-text-properties-function
n-str std-props))
(insert n-str))
;; get out of the prompt area
- [elpa] master db94a12 043/348: ivy.el (ivy-completion-in-region): Fix double insert bug, (continued)
- [elpa] master db94a12 043/348: ivy.el (ivy-completion-in-region): Fix double insert bug, Oleh Krehel, 2017/04/08
- [elpa] master de91a77 042/348: swiper.el (swiper-occur): Add require, Oleh Krehel, 2017/04/08
- [elpa] master fabcdc0 004/348: doc/Changelog.org: Add custom ids and whitespace in the end, Oleh Krehel, 2017/04/08
- [elpa] master c30a6e2 046/348: ivy.el (ivy-minibuffer-map): Undo remap, Oleh Krehel, 2017/04/08
- [elpa] master 3e1a940 045/348: counsel.el: Fix byte compile warnings, Oleh Krehel, 2017/04/08
- [elpa] master c960de5 047/348: counsel.el (counsel-grep-or-swiper): Don't grep on compressed files, Oleh Krehel, 2017/04/08
- [elpa] master 2776358 059/348: Show current value of the variable in the prompt, Oleh Krehel, 2017/04/08
- [elpa] master beee0b7 048/348: counsel.el (counsel-git): Add better error message, Oleh Krehel, 2017/04/08
- [elpa] master 65948fc 053/348: colir.el (colir-parse-color): Fix color parsing in terminal, Oleh Krehel, 2017/04/08
- [elpa] master e987cef 061/348: counsel.el (counsel-read-setq-expression): Fix Eldoc nag, Oleh Krehel, 2017/04/08
- [elpa] master 0091c8a 058/348: ivy.el (ivy-set-prompt-text-properties-function): New devar,
Oleh Krehel <=
- [elpa] master 473c595 064/348: Facilitate the sorting of cons cell input to ivy-read, Oleh Krehel, 2017/04/08
- [elpa] master 23bd7a4 075/348: counsel.el (counsel-git): Add :caller, Oleh Krehel, 2017/04/08
- [elpa] master 74358c2 070/348: Purge all dependency on helm-rhythmbox, Oleh Krehel, 2017/04/08
- [elpa] master 56aa605 076/348: ivy.el (ivy-add-prompt-count): Refactor from ivy--reset-state, Oleh Krehel, 2017/04/08
- [elpa] master 9c01abf 003/348: doc/Changelog.org: Add hlines, Oleh Krehel, 2017/04/08
- [elpa] master e53f256 087/348: ivy.el (ivy-minibuffer-map): Move ivy-toggle-regexp-quote from "M-q" to "M-r", Oleh Krehel, 2017/04/08
- [elpa] master af5f097 108/348: counsel.el (counsel-locate-action-extern): Make interactive, Oleh Krehel, 2017/04/08
- [elpa] master 0028c8c 106/348: counsel.el (counsel-outline): New command, Oleh Krehel, 2017/04/08
- [elpa] master 1d8b4f8 110/348: ivy.el (ivy-sort-matches-functions-alist): New sorting for ivy-switch-buffer, Oleh Krehel, 2017/04/08
- [elpa] master 027fbac 114/348: swiper.el (swiper-multi-action-2): Fix swiper-all, Oleh Krehel, 2017/04/08