[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a817342 14/67: ivy.el: Improve the highlighting in the min
From: |
Oleh Krehel |
Subject: |
[elpa] master a817342 14/67: ivy.el: Improve the highlighting in the minibuffer |
Date: |
Sun, 22 Mar 2015 17:33:52 +0000 |
branch: master
commit a8173420e5dd40e9cb558cdad74f45a7cc499e50
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el: Improve the highlighting in the minibuffer
* ivy.el (ivy--add-face): Use `add-face-text-property' if it's
available. You need to upgrade to Emacs 24.4 to get this feature.
(ivy-completions): Use `ivy--add-face'.
---
ivy.el | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/ivy.el b/ivy.el
index a6b4b66..45a8700 100644
--- a/ivy.el
+++ b/ivy.el
@@ -218,6 +218,16 @@ Should be run via minibuffer `post-command-hook'."
(defvar ivy--old-cands nil
"Store the candidates matched by `ivy--old-re'.")
+(defun ivy--add-face (str face)
+ "Propertize STR with FACE.
+A better function `add-face-text-property' is used if it's available.
+Otherwise, `propertize'."
+ (if (fboundp 'add-face-text-property)
+ (progn
+ (add-face-text-property 0 (length str) face t str)
+ str)
+ (propertize str 'face face)))
+
(defun ivy-completions (name candidates)
"Return as text the current completions.
NAME is a string of words separated by spaces that is used to
@@ -252,7 +262,7 @@ CANDIDATES is a list of strings."
(setq ivy--current (copy-sequence
(nth index cands)))
(setf (nth index cands)
- (propertize ivy--current 'face 'ivy-current-match))
+ (ivy--add-face ivy--current 'ivy-current-match))
(concat "\n" (mapconcat #'identity cands "\n"))))))
(provide 'ivy)
- [elpa] master c990320 02/67: Update call to `font-lock-ensure', (continued)
- [elpa] master c990320 02/67: Update call to `font-lock-ensure', Oleh Krehel, 2015/03/22
- [elpa] master 7159d84 03/67: swiper.el (swiper--regex): Zero groups without space, Oleh Krehel, 2015/03/22
- [elpa] master 3a4cb1f 05/67: Add compatibility alias for `font-lock-ensure', Oleh Krehel, 2015/03/22
- [elpa] master fed3aff 04/67: README.md: Add, Oleh Krehel, 2015/03/22
- [elpa] master 16be7e1 01/67: Initial import, Oleh Krehel, 2015/03/22
- [elpa] master ff0ee94 06/67: Add dependency on emacs 24.1, Oleh Krehel, 2015/03/22
- [elpa] master 1c0b30b 07/67: add autoload cookie for lazy loading, Oleh Krehel, 2015/03/22
- [elpa] master 1099ebf 08/67: Use cl-lib macros instead of cl.el, Oleh Krehel, 2015/03/22
- [elpa] master 7b86747 09/67: swiper.el (swiper--regex): Update signature, Oleh Krehel, 2015/03/22
- [elpa] master a267b34 10/67: familiar isearch key bindings while helm is active, Oleh Krehel, 2015/03/22
- [elpa] master a817342 14/67: ivy.el: Improve the highlighting in the minibuffer,
Oleh Krehel <=
- [elpa] master 97ab66a 13/67: README.md: Update, Oleh Krehel, 2015/03/22
- [elpa] master eb829a9 16/67: Account for zero-length regex matches, Oleh Krehel, 2015/03/22
- [elpa] master 9bcf1dc 12/67: Update dependencies., Oleh Krehel, 2015/03/22
- [elpa] master 7cea819 18/67: ivy.el: Add `ivy-exit', Oleh Krehel, 2015/03/22
- [elpa] master eb1def0 17/67: Add initial-input optional argument, Oleh Krehel, 2015/03/22
- [elpa] master 2f5cc11 15/67: swiper.el: Use `with-selected-window' instead of `with-current-buffer', Oleh Krehel, 2015/03/22
- [elpa] master 02065be 19/67: swiper.el: Restore original point on canceling, Oleh Krehel, 2015/03/22
- [elpa] master 6a874a4 11/67: Add `ivy' back end, Oleh Krehel, 2015/03/22
- [elpa] master f268cc8 21/67: Reveal invisible overlays, Oleh Krehel, 2015/03/22
- [elpa] master 835208a 20/67: Inherit standard faces by default, Oleh Krehel, 2015/03/22