* lisp/faces.el (read-face-name): Rename arg `string-describing-default'

to `default'.  Doc fix.  Display the default value in quotes
in the prompt.  With empty input, return the `default' arg,
unless the default value is a string (in which case return nil).
(describe-face): Replace the string `default' arg of `read-face-name'
with the symbol `default'.
http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg01109.html
This commit is contained in:
Juri Linkov 2010-07-03 01:28:52 +03:00
parent c532d34963
commit c91e692bdf
2 changed files with 18 additions and 8 deletions

View file

@ -1,3 +1,12 @@
2010-07-02 Juri Linkov <juri@jurta.org>
* faces.el (read-face-name): Rename arg `string-describing-default'
to `default'. Doc fix. Display the default value in quotes
in the prompt. With empty input, return the `default' arg,
unless the default value is a string (in which case return nil).
(describe-face): Replace the string `default' arg of `read-face-name'
with the symbol `default'.
2010-07-02 Chong Yidong <cyd@stupidchicken.com>
* emulation/viper-cmd.el (viper-delete-backward-char)

View file

@ -915,13 +915,14 @@ of the default face. Value is FACE."
;;; Interactively modifying faces.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun read-face-name (prompt &optional string-describing-default multiple)
(defun read-face-name (prompt &optional default multiple)
"Read a face, defaulting to the face or faces on the char after point.
If it has the property `read-face-name', that overrides the `face' property.
PROMPT should be a string that describes what the caller will do with the face;
it should not end in a space.
STRING-DESCRIBING-DEFAULT should describe what default the caller will use if
the user just types RET; you can omit it.
The optional argument DEFAULT provides the value to display in the
minibuffer prompt that is returned if the user just types RET
unless DEFAULT is a string (in which case nil is returned).
If MULTIPLE is non-nil, return a list of faces (possibly only one).
Otherwise, return a single face."
(let ((faceprop (or (get-char-property (point) 'read-face-name)
@ -960,10 +961,10 @@ Otherwise, return a single face."
(let* ((input
;; Read the input.
(completing-read-multiple
(if (or faces string-describing-default)
(format "%s (default %s): " prompt
(if (or faces default)
(format "%s (default `%s'): " prompt
(if faces (mapconcat 'symbol-name faces ",")
string-describing-default))
default))
(format "%s: " prompt))
(completion-table-in-turn nonaliasfaces aliasfaces)
nil t nil 'face-name-history
@ -971,7 +972,7 @@ Otherwise, return a single face."
;; Canonicalize the output.
(output
(cond ((or (equal input "") (equal input '("")))
faces)
(or faces (unless (stringp default) default)))
((stringp input)
(mapcar 'intern (split-string input ", *" t)))
((listp input)
@ -1334,7 +1335,7 @@ and FRAME defaults to the selected frame.
If the optional argument FRAME is given, report on face FACE in that frame.
If FRAME is t, report on the defaults for face FACE (for new frames).
If FRAME is omitted or nil, use the selected frame."
(interactive (list (read-face-name "Describe face" "= `default' face" t)))
(interactive (list (read-face-name "Describe face" 'default t)))
(let* ((attrs '((:family . "Family")
(:foundry . "Foundry")
(:width . "Width")