diff options
| -rw-r--r-- | lisp/faces.el | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index bdaee4cec5f..cad2e932519 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -869,7 +869,10 @@ Otherwise, return a single face." | |||
| 869 | (aliasfaces nil) | 869 | (aliasfaces nil) |
| 870 | (nonaliasfaces nil) | 870 | (nonaliasfaces nil) |
| 871 | faces) | 871 | faces) |
| 872 | ;; Make a list of the named faces that the `face' property uses. | 872 | ;; Try to get a face name from the buffer. |
| 873 | (if (memq (intern-soft (thing-at-point 'symbol)) (face-list)) | ||
| 874 | (setq faces (list (intern-soft (thing-at-point 'symbol))))) | ||
| 875 | ;; Add the named faces that the `face' property uses. | ||
| 873 | (if (and (listp faceprop) | 876 | (if (and (listp faceprop) |
| 874 | ;; Don't treat an attribute spec as a list of faces. | 877 | ;; Don't treat an attribute spec as a list of faces. |
| 875 | (not (keywordp (car faceprop))) | 878 | (not (keywordp (car faceprop))) |
| @@ -879,10 +882,6 @@ Otherwise, return a single face." | |||
| 879 | (push f faces))) | 882 | (push f faces))) |
| 880 | (if (symbolp faceprop) | 883 | (if (symbolp faceprop) |
| 881 | (push faceprop faces))) | 884 | (push faceprop faces))) |
| 882 | ;; If there are none, try to get a face name from the buffer. | ||
| 883 | (if (and (null faces) | ||
| 884 | (memq (intern-soft (thing-at-point 'symbol)) (face-list))) | ||
| 885 | (setq faces (list (intern-soft (thing-at-point 'symbol))))) | ||
| 886 | 885 | ||
| 887 | ;; Build up the completion tables. | 886 | ;; Build up the completion tables. |
| 888 | (mapatoms (lambda (s) | 887 | (mapatoms (lambda (s) |
| @@ -896,22 +895,27 @@ Otherwise, return a single face." | |||
| 896 | (unless multiple | 895 | (unless multiple |
| 897 | (if faces | 896 | (if faces |
| 898 | (setq faces (list (car faces))))) | 897 | (setq faces (list (car faces))))) |
| 898 | (require 'crm) | ||
| 899 | (let* ((input | 899 | (let* ((input |
| 900 | ;; Read the input. | 900 | ;; Read the input. |
| 901 | (completing-read | 901 | (completing-read-multiple |
| 902 | (if (or faces string-describing-default) | 902 | (if (or faces string-describing-default) |
| 903 | (format "%s (default %s): " prompt | 903 | (format "%s (default %s): " prompt |
| 904 | (if faces (mapconcat 'symbol-name faces ", ") | 904 | (if faces (mapconcat 'symbol-name faces ",") |
| 905 | string-describing-default)) | 905 | string-describing-default)) |
| 906 | (format "%s: " prompt)) | 906 | (format "%s: " prompt)) |
| 907 | (complete-in-turn nonaliasfaces aliasfaces) nil t)) | 907 | (complete-in-turn nonaliasfaces aliasfaces) |
| 908 | nil t nil nil | ||
| 909 | (if faces (mapconcat 'symbol-name faces ",")))) | ||
| 908 | ;; Canonicalize the output. | 910 | ;; Canonicalize the output. |
| 909 | (output | 911 | (output |
| 910 | (if (equal input "") | 912 | (cond ((or (equal input "") (equal input '(""))) |
| 911 | faces | 913 | faces) |
| 912 | (if (stringp input) | 914 | ((stringp input) |
| 913 | (list (intern input)) | 915 | (mapcar 'intern (split-string input ", *" t))) |
| 914 | input)))) | 916 | ((listp input) |
| 917 | (mapcar 'intern input)) | ||
| 918 | (input)))) | ||
| 915 | ;; Return either a list of faces or just one face. | 919 | ;; Return either a list of faces or just one face. |
| 916 | (if multiple | 920 | (if multiple |
| 917 | output | 921 | output |