[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: read-face-name PROMPT arg should be self-contained, including ": "

From: Drew Adams
Subject: RE: read-face-name PROMPT arg should be self-contained, including ": "
Date: Sat, 17 Mar 2007 12:13:27 -0700

`read-face-name' still blindly appends ": " to the prompt it is supplied.
This means that it doesn't conform to what other functions, such as
`completing-read' do. It also means that code that is intended to work with
Emacs 20 as well must have two separate calls to `read-face-name', just to
work around the change in  prompt behavior, one with a prompt arg that
includes the ": " and one with a prompt arg that doesn't include it.

Can we please change this exceptional prompt treatment of `read-face-name',
to make it compatible with `completing-read' behavior and with the previous
`read-face-name' behavior? Nothing important is gained by having the
function tweak the prompt blindly this way. Please let user code decide what
prompt to use, rather than having `read-file-name' try to second-guess what
prompt is needed.

If it is insisted that `read-file-name' try to be smart this way, then at
least have it check the prompt arg to first strip any trailing ": ", before
it appends ": ". That will let most programs that use it work with any Emacs
version. Something as simple as this, for example:

(when (string-match ": $" prompt)
  (setq prompt (substring prompt 0 -2)))

(It would still be better to let user programs control the prompt, with no

P.S. I suggest this for Emacs, not for myself. I've already redefined
`read-face-name' in my own code to undo this prompt intelligence.

> From: Drew Adams Sent: Tuesday, January 23, 2007 10:32 AM
> To: Emacs-Pretest-Bug
> emacs -Q
> `read-face-name' has changed the meaning and behavior of its PROMPT
> arg since Emacs 20, and it is now unconventional, conflicting with
> standard Emacs treatment of PROMPT args. It should not append ": ".
> Instead, calling functions should do that themselves as they deem
> appropriate.
> This change was made in Emacs 21, but it is not a good change.  It is
> presumably an attempt to be smart, but it reduces flexibility for
> calling functions.  `read-face-name' should treat its PROMPT arg the
> same way that other Emacs prompting functions, such as
> `completing-read', treat their PROMPT args.
> There is at least one other function that is [also] non-standard wrt
> tacking on ": " instead of expecting the PROMPT arg to include it if
> needed: `bookmark-completing-read'.  This problem should be fixed for
> `bookmark-completing-read' also.  It's better to leave ": " to the
> calling function.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]