From bf0b6fab032bd35fae36f7371b7cd1fe3bfaaac7 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 1 May 2016 16:53:38 +0200 Subject: 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). --- src/minibuf.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src') 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); } -- cgit v1.2.1