summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2016-05-01 16:53:38 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2016-05-01 16:53:38 +0200
commitbf0b6fab032bd35fae36f7371b7cd1fe3bfaaac7 (patch)
tree4bbed3f5de389fea0f5f66a78a100d623accee2d /src/minibuf.c
parent8cfd9ba1a97a02157c6b730cca9d61b0fb7de53b (diff)
downloademacs-bf0b6fab032bd35fae36f7371b7cd1fe3bfaaac7.tar.gz
Allow minibuffer prompts to use faces
* doc/lispref/minibuf.texi (Text from Minibuffer): Document `minibuffer-prompt-properties' and explain how faces work in the minibuffer prompt. * src/minibuf.c (read_minibuf): If `face' is in `minibuffer-prompt-properties', apply it to the end of the face list to allow users to have their own faces on the prompts (bug#16136).
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 0b8b00ce2c9..d2a4c9b9538 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -630,8 +630,31 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
Qrear_nonsticky, Qt, Qnil);
Fput_text_property (make_number (BEG), make_number (PT),
Qfield, Qt, Qnil);
- Fadd_text_properties (make_number (BEG), make_number (PT),
- Vminibuffer_prompt_properties, Qnil);
+ if (Fconsp (Vminibuffer_prompt_properties))
+ {
+ /* We want to apply all properties from
+ `minibuffer-prompt-properties' to the region normally,
+ but if the `face' property is present, add that
+ property to the end of the face properties to avoid
+ overwriting faces. */
+ Lisp_Object list = Vminibuffer_prompt_properties;
+ while (CONSP (list))
+ {
+ Lisp_Object key = XCAR (list);
+ list = XCDR (list);
+ if (CONSP (list))
+ {
+ Lisp_Object val = XCAR (list);
+ list = XCDR (list);
+ if (EQ (key, Qface))
+ Fadd_face_text_property (make_number (BEG),
+ make_number (PT), val, Qt, Qnil);
+ else
+ Fput_text_property (make_number (BEG), make_number (PT),
+ key, val, Qnil);
+ }
+ }
+ }
}
unbind_to (count1, Qnil);
}