unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "Emacs-Devel" <emacs-devel@gnu.org>
Subject: RE: read-face-name PROMPT arg should be self-contained, including ": "
Date: Sat, 17 Mar 2007 12:13:27 -0700	[thread overview]
Message-ID: <BDEIJAFNGDOAGCJIPKPBGEFBCDAA.drew.adams@oracle.com> (raw)
In-Reply-To: <BDEIJAFNGDOAGCJIPKPBCEBOCCAA.drew.adams@oracle.com>

`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
second-guessing.)

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	other threads:[~2007-03-17 19:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BDEIJAFNGDOAGCJIPKPBCEBOCCAA.drew.adams@oracle.com>
2007-03-17 19:13 ` Drew Adams [this message]
2007-03-18 12:19   ` read-face-name PROMPT arg should be self-contained, including ": " Richard Stallman
2007-03-18 22:07     ` Drew Adams
2007-03-19  2:39       ` Stefan Monnier
2007-03-19 14:29         ` Drew Adams
2007-03-19 14:57           ` Stefan Monnier
2007-03-19 17:24             ` Drew Adams
2007-03-19 19:43               ` Stefan Monnier
2007-03-19 20:07                 ` Drew Adams
2007-03-19 20:15                   ` Tamas Patrovics
2007-03-19 18:10         ` Richard Stallman
2007-03-19 19:42           ` Stefan Monnier
2007-03-20 16:13             ` Richard Stallman
2007-03-21  3:47               ` Stefan Monnier
2007-04-02 16:59       ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BDEIJAFNGDOAGCJIPKPBGEFBCDAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).