diff options
| author | Juanma Barranquero | 2005-06-01 10:43:54 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2005-06-01 10:43:54 +0000 |
| commit | 011131fda8fd0f6c1d967e43fc38f1ceb31d96d3 (patch) | |
| tree | 0b4768e3d70f2fe8cbadf816bbf817ba6d62d8e2 /lisp | |
| parent | 02a6375c0eb40fe699c7b7334e6bedb804fd87c9 (diff) | |
| download | emacs-011131fda8fd0f6c1d967e43fc38f1ceb31d96d3.tar.gz emacs-011131fda8fd0f6c1d967e43fc38f1ceb31d96d3.zip | |
(list-faces-display): Improve the formatting by computing the maximum length
required for any face-name (reworked patch of 1999-01-11, accidentally deleted
on 1999-07-21).
(internal-find-face): Remove redundant info in docstring.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/faces.el | 35 |
2 files changed, 26 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 36b86720bfc..8312df06d6e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2005-06-01 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * faces.el (list-faces-display): Improve the formatting by | ||
| 4 | computing the maximum length required for any face-name (reworked | ||
| 5 | patch of 1999-01-11, accidentally deleted on 1999-07-21). | ||
| 6 | (internal-find-face): Remove redundant info in docstring. | ||
| 7 | |||
| 1 | 2005-06-01 Nick Roberts <nickrob@snap.net.nz> | 8 | 2005-06-01 Nick Roberts <nickrob@snap.net.nz> |
| 2 | 9 | ||
| 3 | * progmodes/gdb-ui.el (gdb-set-gud-minor-mode-1) | 10 | * progmodes/gdb-ui.el (gdb-set-gud-minor-mode-1) |
diff --git a/lisp/faces.el b/lisp/faces.el index c89001482ac..ccf427e6f12 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -183,10 +183,7 @@ Return nil if there is no such face. | |||
| 183 | If the optional argument FRAME is given, this gets the face NAME for | 183 | If the optional argument FRAME is given, this gets the face NAME for |
| 184 | that frame; otherwise, it uses the selected frame. | 184 | that frame; otherwise, it uses the selected frame. |
| 185 | If FRAME is the symbol t, then the global, non-frame face is returned. | 185 | If FRAME is the symbol t, then the global, non-frame face is returned. |
| 186 | If NAME is already a face, it is simply returned. | 186 | If NAME is already a face, it is simply returned." |
| 187 | |||
| 188 | This function is defined for compatibility with Emacs 20.2. It | ||
| 189 | should not be used anymore." | ||
| 190 | (facep name)) | 187 | (facep name)) |
| 191 | (make-obsolete 'internal-find-face 'facep "21.1") | 188 | (make-obsolete 'internal-find-face 'facep "21.1") |
| 192 | 189 | ||
| @@ -1154,18 +1151,24 @@ this regular expression. When called interactively with a prefix | |||
| 1154 | arg, prompt for a regular expression." | 1151 | arg, prompt for a regular expression." |
| 1155 | (interactive (list (and current-prefix-arg | 1152 | (interactive (list (and current-prefix-arg |
| 1156 | (read-string "List faces matching regexp: ")))) | 1153 | (read-string "List faces matching regexp: ")))) |
| 1157 | (let ((faces (sort (face-list) #'string-lessp)) | 1154 | (let ((all-faces (zerop (length regexp))) |
| 1158 | (frame (selected-frame)) | 1155 | (frame (selected-frame)) |
| 1156 | (max-length 0) | ||
| 1157 | faces line-format | ||
| 1159 | disp-frame window face-name) | 1158 | disp-frame window face-name) |
| 1160 | (when (> (length regexp) 0) | 1159 | ;; We filter and take the max length in one pass |
| 1161 | (setq faces | 1160 | (setq faces |
| 1162 | (delq nil | 1161 | (delq nil |
| 1163 | (mapcar (lambda (f) | 1162 | (mapcar (lambda (f) |
| 1164 | (when (string-match regexp (symbol-name f)) | 1163 | (let ((s (symbol-name f))) |
| 1165 | f)) | 1164 | (when (or all-faces (string-match regexp s)) |
| 1166 | faces))) | 1165 | (setq max-length (max (length s) max-length)) |
| 1167 | (unless faces | 1166 | f))) |
| 1168 | (error "No faces matching \"%s\"" regexp))) | 1167 | (sort (face-list) #'string-lessp)))) |
| 1168 | (unless faces | ||
| 1169 | (error "No faces matching \"%s\"" regexp)) | ||
| 1170 | (setq max-length (1+ max-length) | ||
| 1171 | line-format (format "%%-%ds" max-length)) | ||
| 1169 | (with-output-to-temp-buffer "*Faces*" | 1172 | (with-output-to-temp-buffer "*Faces*" |
| 1170 | (save-excursion | 1173 | (save-excursion |
| 1171 | (set-buffer standard-output) | 1174 | (set-buffer standard-output) |
| @@ -1180,7 +1183,7 @@ arg, prompt for a regular expression." | |||
| 1180 | (setq help-xref-stack nil) | 1183 | (setq help-xref-stack nil) |
| 1181 | (dolist (face faces) | 1184 | (dolist (face faces) |
| 1182 | (setq face-name (symbol-name face)) | 1185 | (setq face-name (symbol-name face)) |
| 1183 | (insert (format "%25s " face-name)) | 1186 | (insert (format line-format face-name)) |
| 1184 | ;; Hyperlink to a customization buffer for the face. Using | 1187 | ;; Hyperlink to a customization buffer for the face. Using |
| 1185 | ;; the help xref mechanism may not be the best way. | 1188 | ;; the help xref mechanism may not be the best way. |
| 1186 | (save-excursion | 1189 | (save-excursion |
| @@ -1205,7 +1208,7 @@ arg, prompt for a regular expression." | |||
| 1205 | (goto-char beg) | 1208 | (goto-char beg) |
| 1206 | (forward-line 1) | 1209 | (forward-line 1) |
| 1207 | (while (not (eobp)) | 1210 | (while (not (eobp)) |
| 1208 | (insert " ") | 1211 | (insert-char ?\s max-length) |
| 1209 | (forward-line 1)))) | 1212 | (forward-line 1)))) |
| 1210 | (goto-char (point-min))) | 1213 | (goto-char (point-min))) |
| 1211 | (print-help-return-message)) | 1214 | (print-help-return-message)) |