[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a275a2a 60/67: Use `font-lock-append-text-property' to non
From: |
Oleh Krehel |
Subject: |
[elpa] master a275a2a 60/67: Use `font-lock-append-text-property' to non-destructively modify a |
Date: |
Sun, 22 Mar 2015 17:34:11 +0000 |
branch: master
commit a275a2a37db9b062a20876c16aec2d9f058a0c5c
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Use `font-lock-append-text-property' to non-destructively modify a
string
* ivy.el (ivy--add-face): Improve.
`font-lock-append-text-property' non-destructively changes properties in
a string, which means if a string was copied from another and modified,
the original will not be changed.
In this way, it's better than `add-face-text-property'; and still better
than `propertize' that simply erases all properties before applying.
Fixes #22
---
ivy.el | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/ivy.el b/ivy.el
index 21e6f12..2f798ce 100644
--- a/ivy.el
+++ b/ivy.el
@@ -334,13 +334,10 @@ Should be run via minibuffer `post-command-hook'."
(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)))
+`font-lock-append-text-property' is used, since it's better than
+`propertize' or `add-face-text-property' in this case."
+ (font-lock-append-text-property 0 (length str) 'face face str)
+ str)
(defun ivy-completions (name candidates)
"Return as text the current completions.
- [elpa] master cc4bf75 52/67: README.md: Add build status, (continued)
- [elpa] master cc4bf75 52/67: README.md: Add build status, Oleh Krehel, 2015/03/22
- [elpa] master 2b8e4e1 53/67: ivy.el: Remove while-no-input, Oleh Krehel, 2015/03/22
- [elpa] master 2191bdb 54/67: ivy.el (ivy-completions): Simplify, Oleh Krehel, 2015/03/22
- [elpa] master d587fa2 51/67: ivy.el (ivy-read): Allow for format-style PROMPT, Oleh Krehel, 2015/03/22
- [elpa] master 9f9c4dc 57/67: swiper-helm.el: Fix typo, Oleh Krehel, 2015/03/22
- [elpa] master 3a08a88 50/67: ivy.el (ivy-read): Change index to preselect, Oleh Krehel, 2015/03/22
- [elpa] master d2b2813 55/67: swiper-helm.el: Copy all helm stuff here, Oleh Krehel, 2015/03/22
- [elpa] master c4acef9 56/67: swiper.el: Remove the helm bits, Oleh Krehel, 2015/03/22
- [elpa] master 0c85d9a 58/67: Add a custom `ivy-count-format', Oleh Krehel, 2015/03/22
- [elpa] master c2e58e9 59/67: Fix invalid package header line, Oleh Krehel, 2015/03/22
- [elpa] master a275a2a 60/67: Use `font-lock-append-text-property' to non-destructively modify a,
Oleh Krehel <=
- [elpa] master 7876619 61/67: Update "C-n" and "C-p" bindings, Oleh Krehel, 2015/03/22
- [elpa] master f20b287 62/67: swiper.el (swiper--init): Set `swiper--opoint', Oleh Krehel, 2015/03/22
- [elpa] master bb6c40c 63/67: swiper.el (swiper-min-highlight): New defcustom, Oleh Krehel, 2015/03/22
- [elpa] master cf71b09 64/67: ivy.el (ivy-wrap): New defcustom, Oleh Krehel, 2015/03/22
- [elpa] master 55414c3 66/67: Update Copyright, Oleh Krehel, 2015/03/22
- [elpa] master 4358c03 65/67: Move swiper-helm to another repo, Oleh Krehel, 2015/03/22
- [elpa] master 302a16a 67/67: Add 'packages/swiper/' from commit '55414c321ca07bd86f0f1efaf8f6130617e6fad6', Oleh Krehel, 2015/03/22