[Top][All Lists]

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

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

From: Drew Adams
Subject: read-face-name PROMPT arg should be self-contained, including ": "
Date: Tue, 23 Jan 2007 10:31:58 -0800

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

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.

Furthermore, there are several prompts used in calls to
`read-face-name' in library `faces.el' that are non-standard and
non-English: all of those that begin with "Make which face".  In these
cases, the final prompt reads like this:

Make which face bold:
Make which face bold (default font-lock-function-name-face):

You might say that every prompt is an implicit question: the program
is asking the user for input.  However, it is really a request, not a
question, and the proper mode for most prompts is the imperative, not
the interrogative.  Usually, therefore, a prompt is expressed
imperatively.  Confirmation questions (e.g. `y-or-n-p') are a notable
exception, where the point is to draw extra attention to a user

In any case, whenever a prompt is expressed as an explicit question,
for whatever reason, it needs to be followed by a question mark (`?').

Obviously, with the automatic appending of ": " here, it would have
been inappropriate to include the question mark also: "Make which face
bold?: ".  The implementation thus ends up distorting the punctuation
to be used.

The proper fix, however is not to use a question at all here.
Conventional, and better, Emacs prompts for this are imperative:

Make face bold:
Make face bold (default font-lock-function-name-face):

`read-face-name' has slowly progressed from Emacs 20 (where it didn't
even have a doc string), but it is still not up to snuff.  Please
bring it up to the standard of `completing-read' by correcting this
PROMPT bug and fixing the question prompts.

There is at least one other function that is 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.

In GNU Emacs (i386-mingw-nt5.1.2600)
 of 2006-12-30 on LENNART-69DE564
X server distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/g/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Dired by name

Minor modes in effect:
  encoded-kbd-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
<help-echo> <help-echo> <down-mouse-1> <mouse-1> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<menu-bar> <help-menu> <report-emacs-bug>

Recent messages:
(C:\Emacs-22-2006-12-30\bin\emacs.exe -q --no-site-file --debug-init
Loading encoded-kb...done
For information about the GNU Project and its goals, type C-h C-p.
Loading dired...
Loading regexp-opt...done
Loading dired...done
For information about the GNU Project and its goals, type C-h C-p.
Loading emacsbug...done

reply via email to

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