diff options
| author | Juri Linkov | 2010-07-03 01:28:52 +0300 |
|---|---|---|
| committer | Juri Linkov | 2010-07-03 01:28:52 +0300 |
| commit | c91e692bdff3f5c7e68a538f02b293d1487188b4 (patch) | |
| tree | 866a987a1ac156850cfe487f1c57eb9962ecf826 | |
| parent | c532d349630038c45897e88004a8142a82e9dc85 (diff) | |
| download | emacs-c91e692bdff3f5c7e68a538f02b293d1487188b4.tar.gz emacs-c91e692bdff3f5c7e68a538f02b293d1487188b4.zip | |
* 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
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/faces.el | 17 |
2 files changed, 18 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 90d1260b998..de4671ec509 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2010-07-02 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * faces.el (read-face-name): Rename arg `string-describing-default' | ||
| 4 | to `default'. Doc fix. Display the default value in quotes | ||
| 5 | in the prompt. With empty input, return the `default' arg, | ||
| 6 | unless the default value is a string (in which case return nil). | ||
| 7 | (describe-face): Replace the string `default' arg of `read-face-name' | ||
| 8 | with the symbol `default'. | ||
| 9 | |||
| 1 | 2010-07-02 Chong Yidong <cyd@stupidchicken.com> | 10 | 2010-07-02 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 11 | ||
| 3 | * emulation/viper-cmd.el (viper-delete-backward-char) | 12 | * emulation/viper-cmd.el (viper-delete-backward-char) |
diff --git a/lisp/faces.el b/lisp/faces.el index 61476e3cd5f..83c7c8b2a0f 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -915,13 +915,14 @@ of the default face. Value is FACE." | |||
| 915 | ;;; Interactively modifying faces. | 915 | ;;; Interactively modifying faces. |
| 916 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 916 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 917 | 917 | ||
| 918 | (defun read-face-name (prompt &optional string-describing-default multiple) | 918 | (defun read-face-name (prompt &optional default multiple) |
| 919 | "Read a face, defaulting to the face or faces on the char after point. | 919 | "Read a face, defaulting to the face or faces on the char after point. |
| 920 | If it has the property `read-face-name', that overrides the `face' property. | 920 | If it has the property `read-face-name', that overrides the `face' property. |
| 921 | PROMPT should be a string that describes what the caller will do with the face; | 921 | PROMPT should be a string that describes what the caller will do with the face; |
| 922 | it should not end in a space. | 922 | it should not end in a space. |
| 923 | STRING-DESCRIBING-DEFAULT should describe what default the caller will use if | 923 | The optional argument DEFAULT provides the value to display in the |
| 924 | the user just types RET; you can omit it. | 924 | minibuffer prompt that is returned if the user just types RET |
| 925 | unless DEFAULT is a string (in which case nil is returned). | ||
| 925 | If MULTIPLE is non-nil, return a list of faces (possibly only one). | 926 | If MULTIPLE is non-nil, return a list of faces (possibly only one). |
| 926 | Otherwise, return a single face." | 927 | Otherwise, return a single face." |
| 927 | (let ((faceprop (or (get-char-property (point) 'read-face-name) | 928 | (let ((faceprop (or (get-char-property (point) 'read-face-name) |
| @@ -960,10 +961,10 @@ Otherwise, return a single face." | |||
| 960 | (let* ((input | 961 | (let* ((input |
| 961 | ;; Read the input. | 962 | ;; Read the input. |
| 962 | (completing-read-multiple | 963 | (completing-read-multiple |
| 963 | (if (or faces string-describing-default) | 964 | (if (or faces default) |
| 964 | (format "%s (default %s): " prompt | 965 | (format "%s (default `%s'): " prompt |
| 965 | (if faces (mapconcat 'symbol-name faces ",") | 966 | (if faces (mapconcat 'symbol-name faces ",") |
| 966 | string-describing-default)) | 967 | default)) |
| 967 | (format "%s: " prompt)) | 968 | (format "%s: " prompt)) |
| 968 | (completion-table-in-turn nonaliasfaces aliasfaces) | 969 | (completion-table-in-turn nonaliasfaces aliasfaces) |
| 969 | nil t nil 'face-name-history | 970 | nil t nil 'face-name-history |
| @@ -971,7 +972,7 @@ Otherwise, return a single face." | |||
| 971 | ;; Canonicalize the output. | 972 | ;; Canonicalize the output. |
| 972 | (output | 973 | (output |
| 973 | (cond ((or (equal input "") (equal input '(""))) | 974 | (cond ((or (equal input "") (equal input '(""))) |
| 974 | faces) | 975 | (or faces (unless (stringp default) default))) |
| 975 | ((stringp input) | 976 | ((stringp input) |
| 976 | (mapcar 'intern (split-string input ", *" t))) | 977 | (mapcar 'intern (split-string input ", *" t))) |
| 977 | ((listp input) | 978 | ((listp input) |
| @@ -1334,7 +1335,7 @@ and FRAME defaults to the selected frame. | |||
| 1334 | If the optional argument FRAME is given, report on face FACE in that frame. | 1335 | If the optional argument FRAME is given, report on face FACE in that frame. |
| 1335 | If FRAME is t, report on the defaults for face FACE (for new frames). | 1336 | If FRAME is t, report on the defaults for face FACE (for new frames). |
| 1336 | If FRAME is omitted or nil, use the selected frame." | 1337 | If FRAME is omitted or nil, use the selected frame." |
| 1337 | (interactive (list (read-face-name "Describe face" "= `default' face" t))) | 1338 | (interactive (list (read-face-name "Describe face" 'default t))) |
| 1338 | (let* ((attrs '((:family . "Family") | 1339 | (let* ((attrs '((:family . "Family") |
| 1339 | (:foundry . "Foundry") | 1340 | (:foundry . "Foundry") |
| 1340 | (:width . "Width") | 1341 | (:width . "Width") |