# HG changeset patch # User Juri Linkov # Date 1278109732 -10800 # Node ID d5e4b1b3498834c45df1774cbe324260d745603c # Parent 5842e8fabe0649a65fb05f5dcf6f20a8382fe2d8 * 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 diff -r 5842e8fabe06 -r d5e4b1b34988 lisp/ChangeLog --- a/lisp/ChangeLog Fri Jul 02 15:18:28 2010 -0700 +++ b/lisp/ChangeLog Sat Jul 03 01:28:52 2010 +0300 @@ -1,3 +1,12 @@ +2010-07-02 Juri Linkov + + * 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 * emulation/viper-cmd.el (viper-delete-backward-char) diff -r 5842e8fabe06 -r d5e4b1b34988 lisp/faces.el --- a/lisp/faces.el Fri Jul 02 15:18:28 2010 -0700 +++ b/lisp/faces.el Sat Jul 03 01:28:52 2010 +0300 @@ -915,13 +915,14 @@ ;;; 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 @@ (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 @@ ;; 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 @@ 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")