diff options
| author | Richard M. Stallman | 2005-02-03 06:47:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-02-03 06:47:16 +0000 |
| commit | e2c11e3b5bdf63e48cb20ccc3cc07033d3d1f34f (patch) | |
| tree | e7b3cbd0fcaa6d09d6db67b17bf49460d1ac1b4f | |
| parent | 30b940a73115f6b2c0b4686d46df399cbd7381d3 (diff) | |
| download | emacs-e2c11e3b5bdf63e48cb20ccc3cc07033d3d1f34f.tar.gz emacs-e2c11e3b5bdf63e48cb20ccc3cc07033d3d1f34f.zip | |
(list-faces-display): Add optional argument.
| -rw-r--r-- | lisp/faces.el | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index a234c902332..4bfa94b062f 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1143,15 +1143,26 @@ Value is a list (FACE NEW-VALUE) where FACE is the face read | |||
| 1143 | ;; conflict with Lucid, which uses that name differently. | 1143 | ;; conflict with Lucid, which uses that name differently. |
| 1144 | 1144 | ||
| 1145 | (defvar help-xref-stack) | 1145 | (defvar help-xref-stack) |
| 1146 | (defun list-faces-display () | 1146 | (defun list-faces-display (&optional regexp) |
| 1147 | "List all faces, using the same sample text in each. | 1147 | "List all faces, using the same sample text in each. |
| 1148 | The sample text is a string that comes from the variable | 1148 | The sample text is a string that comes from the variable |
| 1149 | `list-faces-sample-text'." | 1149 | `list-faces-sample-text'. |
| 1150 | (interactive) | 1150 | |
| 1151 | If REGEXP is non-nil, list only those faces with names matching | ||
| 1152 | this regular expression. When called interactively with a prefix | ||
| 1153 | arg, prompt for a regular expression." | ||
| 1154 | (interactive (list (and current-prefix-arg | ||
| 1155 | (read-string "List faces matching regexp: ")))) | ||
| 1151 | (let ((faces (sort (face-list) #'string-lessp)) | 1156 | (let ((faces (sort (face-list) #'string-lessp)) |
| 1152 | (face nil) | ||
| 1153 | (frame (selected-frame)) | 1157 | (frame (selected-frame)) |
| 1154 | disp-frame window face-name) | 1158 | disp-frame window face-name) |
| 1159 | (when (> (length regexp) 0) | ||
| 1160 | (setq faces | ||
| 1161 | (delq nil | ||
| 1162 | (mapcar (lambda (f) | ||
| 1163 | (when (string-match regexp (symbol-name f)) | ||
| 1164 | f)) | ||
| 1165 | faces)))) | ||
| 1155 | (with-output-to-temp-buffer "*Faces*" | 1166 | (with-output-to-temp-buffer "*Faces*" |
| 1156 | (save-excursion | 1167 | (save-excursion |
| 1157 | (set-buffer standard-output) | 1168 | (set-buffer standard-output) |
| @@ -1164,9 +1175,7 @@ The sample text is a string that comes from the variable | |||
| 1164 | "\\[help-follow] on a face name to customize it\n" | 1175 | "\\[help-follow] on a face name to customize it\n" |
| 1165 | "or on its sample text for a description of the face.\n\n"))) | 1176 | "or on its sample text for a description of the face.\n\n"))) |
| 1166 | (setq help-xref-stack nil) | 1177 | (setq help-xref-stack nil) |
| 1167 | (while faces | 1178 | (dolist (face faces) |
| 1168 | (setq face (car faces)) | ||
| 1169 | (setq faces (cdr faces)) | ||
| 1170 | (setq face-name (symbol-name face)) | 1179 | (setq face-name (symbol-name face)) |
| 1171 | (insert (format "%25s " face-name)) | 1180 | (insert (format "%25s " face-name)) |
| 1172 | ;; Hyperlink to a customization buffer for the face. Using | 1181 | ;; Hyperlink to a customization buffer for the face. Using |
| @@ -1208,6 +1217,7 @@ The sample text is a string that comes from the variable | |||
| 1208 | (copy-face (car faces) (car faces) frame disp-frame) | 1217 | (copy-face (car faces) (car faces) frame disp-frame) |
| 1209 | (setq faces (cdr faces))))))) | 1218 | (setq faces (cdr faces))))))) |
| 1210 | 1219 | ||
| 1220 | |||
| 1211 | (defun describe-face (face &optional frame) | 1221 | (defun describe-face (face &optional frame) |
| 1212 | "Display the properties of face FACE on FRAME. | 1222 | "Display the properties of face FACE on FRAME. |
| 1213 | Interactively, FACE defaults to the faces of the character after point | 1223 | Interactively, FACE defaults to the faces of the character after point |