GNU bug report logs -
#35564
27.0.50; [PATCH] Tweak dired-do-shell-command warning about "wildcard" characters
Previous Next
Reported by: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Date: Sat, 4 May 2019 18:03:02 UTC
Severity: normal
Tags: fixed, moreinfo, patch
Merged with 28969
Found in version 27.0.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 35564 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
martin rudalics <rudalics <at> gmx.at> writes:
>> [1] Compare:
>>
>> (let ((prompt "foobar "))
>> (add-face-text-property 3 6 'warning nil prompt)
>> (yes-or-no-p prompt))
>>
>> With:
>>
>> (let ((prompt "foobar "))
>> (add-face-text-property 3 6 'warning nil prompt)
>> (y-or-n-p prompt))
>
> 'y-or-n-p' propertizes the prompt rigidly as
>
> (read-key (propertize (if (memq answer scroll-actions)
> prompt
> (concat "Please answer y or n. "
> prompt))
> 'face 'minibuffer-prompt)))))
>
> while 'yes-or-no-p' carefully applies 'minibuffer-prompt-properties'
> to any text properties provided with PROMPT.
Well, that's interesting.
I dug into yes-or-no-p until I came across `read_minibuf()'; is this the
code you are referring to?
if (PT > BEG)
{
Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
Qfront_sticky, Qt, Qnil);
Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
Qrear_nonsticky, Qt, Qnil);
Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
Qfield, Qt, Qnil);
if (CONSP (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_fixnum (BEG),
make_fixnum (PT), val, Qt, Qnil);
else
Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
key, val, Qnil);
}
}
}
}
If one were to fix the issue of y-or-n-p hardcoding the face property,
what would be the best way to go?
1. Make a C DEFUN out of this snippet, and have it called by
`read_minibuf()' and `y-or-n-p'.
2. Re-implement this snippet as an Elisp defun, and have it called by
`read_minibuf()' and `y-or-n-p'.
3. (Re-implement this snippet within `y-or-n-p'.)
(FWIW, the attached patch seems to work as a workaround, but I assume
solutions 1 or 2 would be better, by virtue of reusing code)
[0001-Make-y-or-no-p-keep-the-supplied-prompt-s-face.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
Thanks for your help!
Kévin
This bug report was last modified 4 years and 297 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.