unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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
[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).