* Use of minibuffer-prompt face when minibuffer is not involved
@ 2019-05-10 18:35 Kévin Le Gouguec
2019-05-10 20:52 ` Stefan Monnier
0 siblings, 1 reply; 13+ messages in thread
From: Kévin Le Gouguec @ 2019-05-10 18:35 UTC (permalink / raw)
To: emacs-devel
Hello Emacs,
For some reason[1], I found myself wanting to add text properties to
y-or-n-p's prompt. This is currently not possible, as the prompt's
face property is hard-coded like so:
(propertize (if (memq answer scroll-actions)
prompt
(concat "Please answer y or n. "
prompt))
'face 'minibuffer-prompt)))))
An ad-hoc fix seems simple enough[2]; further discussion with Martin
Rudalics and Drew Adams showed that:
- there are other places where this (propertize … 'face
'minibuffer-prompt) idiom is used, such as isearch prompts and
read-char-choice;
- these examples do not actually activate the minibuffer (AFAIU), so
using the minibuffer-prompt face could be considered questionable.
Considering all that, what course of action do you consider worth
pursuing?
0. Do nothing. ("The face might be called minibuffer-prompt, but there
are enough non-minibuffer uses of it that it's not worth fixing
this inconsistency at this point.")
1. Introduce a new face named e.g. prompt, which by default would…
1. … inherit minibuffer-prompt for "visual backward-compatibility".
2. … differ from minibuffer-prompt to teach users the distinction
between echo area and minibuffer.
2. Stop propertizing the prompt; no new face.
I have no horse in this race[3]; I understand both the appeal of 0
(minimize churn and UI inconsistencies during the transition), 1.1
(configurability and smooth transition), 1.2 and 2 (consistency and
pedagogy).
WDYT?
NB: the discussion on bug#35564 also touched on text properties with
tooltips; I figured the subject of (message …)'d prompts is
substantial enough that tooltips could be discussed separately, but
please make sure to check out Martin and Drew's thoughts on the matter
if this is something you want to discuss.
[1] To sum up my initial report over at bug#35564:
- dired-do-shell-command's warning about "wildcard" characters
annoys me, since AFAICT they may not be wildcards at all
(e.g. they may be quoted or backslash-escaped).
- Rather than coming up with a better warning, I toyed with text
properties to build a prompt which highlights these characters.
- I found out that y-or-n-p discards my prompt's text properties.
[2] See patch at bug#35564#11.
[3] Mainly I'd like to fix bug#35564. I assume it can be fixed
whichever way this discussion goes:
1. either someone finds a better phrasing for Dired's warning,
2. or the highlighted prompt implemented in bug#35564#5 is deemed
cute enough and we decide to change y-or-n-p's (propertize …)
into (add-face-text-property …)
1. either locally in y-or-n-p,
2. or in a new function which could be re-used by
read-char-choice et al.,
3. or someone enlightens me as to why Dired calling these
characters "wildcards" is TRT, making the bug report moot.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use of minibuffer-prompt face when minibuffer is not involved
2019-05-10 18:35 Use of minibuffer-prompt face when minibuffer is not involved Kévin Le Gouguec
@ 2019-05-10 20:52 ` Stefan Monnier
2019-05-10 21:59 ` Drew Adams
2019-05-11 13:50 ` Solving bug#35564 (was: Use of minibuffer-prompt face when minibuffer is not involved) Kévin Le Gouguec
0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2019-05-10 20:52 UTC (permalink / raw)
To: emacs-devel
> 0. Do nothing. ("The face might be called minibuffer-prompt, but there
> are enough non-minibuffer uses of it that it's not worth fixing
> this inconsistency at this point.")
That's what I vote for.
More to the point, I think the difference between minibuffer prompts and
non-minibuffer prompts should be a purely internal one. After all, you
could rewrite yes-or-no-p so as not to use a minibuffer or rewrite
y-or-n-p to make it use a minibuffer: should that have as a side-effect
to use a different face, really?
> - dired-do-shell-command's warning about "wildcard" characters
> annoys me, since AFAICT they may not be wildcards at all
> (e.g. they may be quoted or backslash-escaped).
>
> - Rather than coming up with a better warning, I toyed with text
> properties to build a prompt which highlights these characters.
>
> - I found out that y-or-n-p discards my prompt's text properties.
So the problem is not the use of minibuffer-prompt but the fact that it
overrides other faces while applying it. That should be easy to fix by
using `add-face-text-property` instead of `propertize`.
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: Use of minibuffer-prompt face when minibuffer is not involved
2019-05-10 20:52 ` Stefan Monnier
@ 2019-05-10 21:59 ` Drew Adams
2019-05-10 22:36 ` Stefan Monnier
` (3 more replies)
2019-05-11 13:50 ` Solving bug#35564 (was: Use of minibuffer-prompt face when minibuffer is not involved) Kévin Le Gouguec
1 sibling, 4 replies; 13+ messages in thread
From: Drew Adams @ 2019-05-10 21:59 UTC (permalink / raw)
To: Stefan Monnier, emacs-devel
> > 0. Do nothing. ("The face might be called minibuffer-prompt, but there
> > are enough non-minibuffer uses of it that it's not worth fixing
> > this inconsistency at this point.")
>
> That's what I vote for.
>
> More to the point, I think the difference between minibuffer prompts and
> non-minibuffer prompts should be a purely internal one. After all, you
> could rewrite yes-or-no-p so as not to use a minibuffer or rewrite
> y-or-n-p to make it use a minibuffer: should that have as a side-effect
> to use a different face, really?
It's not about y-or-n-p or yes-or-no-p. That's the
wrong way to look at it. Yes-or-no-p is not at all
representative of minibuffer prompting for input.
`minibuffer-prompt' face should be a clear indicator
to users that the minibuffer is active.
Prompting for non-minibuffer input should either not
have a face or should use a different face.
(Users can of course themselves define that face to
look the same as `minibuffer-prompt' if they really
want such "consistency", but Emacs itself should not
force-confuse/identify the two.)
> > - dired-do-shell-command's warning about "wildcard" characters
> > annoys me, since AFAICT they may not be wildcards at all
> > (e.g. they may be quoted or backslash-escaped).
> >
> > - Rather than coming up with a better warning, I toyed with text
> > properties to build a prompt which highlights these characters.
> >
> > - I found out that y-or-n-p discards my prompt's text properties.
>
> So the problem is not the use of minibuffer-prompt but the fact that it
> overrides other faces while applying it. That should be easy to fix by
> using `add-face-text-property` instead of `propertize`.
No. That is not "the problem". That is something
altogether different.
The "problem" reported for `dired-do-shell-command'
has _nothing_ to do with the question of whether
non-minibuffer prompting should use a face and, if
so, which face.
This emacs-dev thread should _drop_ the question of
`dired-do-shell-command' and whether or how its
prompting should best be worded or highlighted or
whatever.
It was a _mistake_ for the bug thread to ever have
confounded the two discussions - and even to confound
a third, also unrelated. discussion about allowing
text properties for `help-echo' tooltips.
The question raised for emacs-devel by this thread
is whether non-minbuffer prompting should have a
face, and if so, which face.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use of minibuffer-prompt face when minibuffer is not involved
2019-05-10 21:59 ` Drew Adams
@ 2019-05-10 22:36 ` Stefan Monnier
2019-05-11 6:25 ` Eli Zaretskii
2019-05-11 13:22 ` Kévin Le Gouguec
` (2 subsequent siblings)
3 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2019-05-10 22:36 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
> The question raised for emacs-devel by this thread
> is whether non-minbuffer prompting should have a
> face, and if so, which face.
My answer was to this question. Let me repeat it to make it clear:
the difference between minibuffer prompts and
non-minibuffer prompts should be a purely internal one.
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use of minibuffer-prompt face when minibuffer is not involved
2019-05-10 22:36 ` Stefan Monnier
@ 2019-05-11 6:25 ` Eli Zaretskii
0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2019-05-11 6:25 UTC (permalink / raw)
To: Stefan Monnier; +Cc: drew.adams, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 10 May 2019 18:36:28 -0400
> Cc: emacs-devel@gnu.org
>
> > The question raised for emacs-devel by this thread
> > is whether non-minbuffer prompting should have a
> > face, and if so, which face.
>
> My answer was to this question. Let me repeat it to make it clear:
> the difference between minibuffer prompts and
> non-minibuffer prompts should be a purely internal one.
And I agree 100%. I think it's a grave mistake to try to tell the
user via faces whether some prompt/text is in the active minibuffer or
not. That just confuses the user with no real gain.
Active minibuffer is an internal detail. I wish it didn't exist at
all, but our implementation forces us to have it. Exposing that to
users is exactly the wrong idea.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use of minibuffer-prompt face when minibuffer is not involved
2019-05-10 21:59 ` Drew Adams
2019-05-10 22:36 ` Stefan Monnier
@ 2019-05-11 13:22 ` Kévin Le Gouguec
[not found] ` <<jwvftpm9buh.fsf-monnier+emacs@gnu.org>
[not found] ` <<<jwvftpm9buh.fsf-monnier+emacs@gnu.org>
3 siblings, 0 replies; 13+ messages in thread
From: Kévin Le Gouguec @ 2019-05-11 13:22 UTC (permalink / raw)
To: Drew Adams; +Cc: Stefan Monnier, emacs-devel
Drew Adams <drew.adams@oracle.com> writes:
> This emacs-dev thread should _drop_ the question of
> `dired-do-shell-command' and whether or how its
> prompting should best be worded or highlighted or
> whatever.
>
> It was a _mistake_ for the bug thread to ever have
> confounded the two discussions - and even to confound
> a third, also unrelated. discussion about allowing
> text properties for `help-echo' tooltips.
>
> The question raised for emacs-devel by this thread
> is whether non-minbuffer prompting should have a
> face, and if so, which face.
Right. Apologies for mentioning the bug thread on emacs-devel. I hoped
that confining it too footnotes would ensure that it would not derail
this thread (while avoiding the XY problem of not mentioning *why* I was
looking at these prompts in the first place); obviously I misjudged.
^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <<jwvftpm9buh.fsf-monnier+emacs@gnu.org>]
[parent not found: <<<jwvftpm9buh.fsf-monnier+emacs@gnu.org>]
* Solving bug#35564 (was: Use of minibuffer-prompt face when minibuffer is not involved)
2019-05-10 20:52 ` Stefan Monnier
2019-05-10 21:59 ` Drew Adams
@ 2019-05-11 13:50 ` Kévin Le Gouguec
2019-05-11 14:13 ` Solving bug#35564 Stefan Monnier
1 sibling, 1 reply; 13+ messages in thread
From: Kévin Le Gouguec @ 2019-05-11 13:50 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> So the problem is not the use of minibuffer-prompt but the fact that it
> overrides other faces while applying it. That should be easy to fix by
> using `add-face-text-property` instead of `propertize`.
Yep, which is what the patch over at bug#35564#11 does. Now it's mostly
a matter of deciding whether we want to solve this bug this way (IMO:
not if someone can simply come up with a better warning and do away with
my highlighted-prompt shenanigans).
If we do, I'll add a proper patch series to this report, to
1. fix y-or-n-p with add-face-text-property,
2. tweak dired's warning using text properties.
^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <<<8736lmi2dg.fsf@gmail.com>]
[parent not found: <<8736lmi2dg.fsf@gmail.com>]
end of thread, other threads:[~2019-05-12 23:32 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-10 18:35 Use of minibuffer-prompt face when minibuffer is not involved Kévin Le Gouguec
2019-05-10 20:52 ` Stefan Monnier
2019-05-10 21:59 ` Drew Adams
2019-05-10 22:36 ` Stefan Monnier
2019-05-11 6:25 ` Eli Zaretskii
2019-05-11 13:22 ` Kévin Le Gouguec
[not found] ` <<jwvftpm9buh.fsf-monnier+emacs@gnu.org>
[not found] ` <<83o949ecdc.fsf@gnu.org>
2019-05-11 13:52 ` Drew Adams
2019-05-11 14:11 ` Eli Zaretskii
2019-05-12 22:31 ` Richard Stallman
2019-05-12 23:32 ` Drew Adams
[not found] ` <<<jwvftpm9buh.fsf-monnier+emacs@gnu.org>
[not found] ` <<<83o949ecdc.fsf@gnu.org>
[not found] ` <<c7e501bb-9dd8-4b00-8647-d0731f2b2565@default>
[not found] ` <<83o949cc88.fsf@gnu.org>
2019-05-11 14:34 ` Drew Adams
2019-05-11 13:50 ` Solving bug#35564 (was: Use of minibuffer-prompt face when minibuffer is not involved) Kévin Le Gouguec
2019-05-11 14:13 ` Solving bug#35564 Stefan Monnier
[not found] <<<8736lmi2dg.fsf@gmail.com>
[not found] <<8736lmi2dg.fsf@gmail.com>
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).