[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/backports-25.2 87a7490 35/46: Clarify `read-face-n
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] scratch/backports-25.2 87a7490 35/46: Clarify `read-face-name' doc and tweak the code |
Date: |
Sun, 2 Oct 2016 14:04:50 +0000 (UTC) |
branch: scratch/backports-25.2
commit 87a7490b29a7d404dbbd545ee0591405ef77dcd4
Author: Lars Ingebrigtsen <address@hidden>
Commit: Noam Postavsky <address@hidden>
Clarify `read-face-name' doc and tweak the code
* lisp/faces.el (read-face-name): Clarify the documentation
and allow a mix of faces and faces names in all cases
(bug#16483).
(cherry picked from commit b01dac19fba2e018100051c7b80b633727db555e)
---
lisp/faces.el | 44 +++++++++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/lisp/faces.el b/lisp/faces.el
index 4053d96..e57baf6 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1003,25 +1003,31 @@ of the default face. Value is FACE."
"Read one or more face names, prompting with PROMPT.
PROMPT should not end in a space or a colon.
-Return DEFAULT if the user enters the empty string.
-If DEFAULT is non-nil, it should be a single face or a list of face names
-\(symbols or strings). In the latter case, return the `car' of DEFAULT
-\(if MULTIPLE is nil, see below), or DEFAULT (if MULTIPLE is non-nil).
-
-If MULTIPLE is non-nil, this function uses `completing-read-multiple'
-to read multiple faces with \"[ \\t]*,[ \\t]*\" as the separator regexp
-and it returns a list of face names. Otherwise, it reads and returns
-a single face name."
- (if (and default (not (stringp default)))
- (setq default
- (cond ((symbolp default)
- (symbol-name default))
- (multiple
- (mapconcat (lambda (f) (if (symbolp f) (symbol-name f) f))
- default ", "))
- ;; If we only want one, and the default is more than one,
- ;; discard the unwanted ones.
- (t (symbol-name (car default))))))
+If DEFAULT is non-nil, it should be a face (a symbol) or a face
+name (a string). It can also be a list of faces or face names.
+
+If MULTIPLE is non-nil, the return value from this function is a
+list of faces. Otherwise a single face is returned.
+
+If the user enter the empty string at the prompt, DEFAULT is
+returned after a possible transformation according to MULTIPLE.
+That is, if DEFAULT is a list and MULTIPLE is nil, the first
+element of DEFAULT is returned. If DEFAULT isn't a list, but
+MULTIPLE is non-nil, a one-element list containing DEFAULT is
+returned. Otherwise, DEFAULT is returned verbatim."
+ (unless (listp default)
+ (setq default (list default)))
+ (when default
+ (setq default
+ (if multiple
+ (mapconcat (lambda (f) (if (symbolp f) (symbol-name f) f))
+ default ", ")
+ ;; If we only want one, and the default is more than one,
+ ;; discard the unwanted ones.
+ (setq default (car default))
+ (if (symbolp default)
+ (symbol-name default)
+ default))))
(when (and default (not multiple))
(require 'crm)
;; For compatibility with `completing-read-multiple' use `crm-separator'
- [Emacs-diffs] scratch/backports-25.2 5c084d9 10/46: Remove spurious newline in package list, (continued)
- [Emacs-diffs] scratch/backports-25.2 5c084d9 10/46: Remove spurious newline in package list, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 80cf0b6 21/46: Restore the fix to bug#18527 from commit d6868025, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 51656da 28/46: Fix number-at-point in lisp buffers, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 0876366 43/46: Fix back-white <-> black-white typo, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 f3a19cf 31/46: Make a menu less ambiguous, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 12d1955 41/46: * lisp/files.el (version-control): Drop :group vc (Bug #14687), Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 cf54324 42/46: Improve error when installing non-package dirs, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 9e9f7c8 45/46: Don't --load directories, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 eb5dd2c 46/46: Don't require isearch-update before isearch-done, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 aad7ede 07/46: Ensure progress when fetching from the queue, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 87a7490 35/46: Clarify `read-face-name' doc and tweak the code,
Noam Postavsky <=
- [Emacs-diffs] scratch/backports-25.2 171ec16 44/46: Avoid error in icalendar--read-element, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 a33eb50 03/46: Let url use default file modes when copying files, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 30376cc 22/46: Allow _ characters in SQL prompts, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 145e369 05/46: Make the nsm query say what it did after the user interaction, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 e1e768e 01/46: Default web pages to right-to-left, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 b16e6c3 09/46: Require that the buffer that we're trying to patch exist, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 e2e25ae 20/46: Make <div> in <li> not insert extra newlines, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 77c3f7f 24/46: Make `q' etc work in image mode again, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 d7de0c4 25/46: smtpmail would say it's done before it is, Noam Postavsky, 2016/10/02
- [Emacs-diffs] scratch/backports-25.2 f65b1a3 27/46: Don't consider colons to be paragraphs starting chars in strings, Noam Postavsky, 2016/10/02