comparison lisp/faces.el @ 24045:094765645c52

(list-faces-display): Improve the formatting by computing the maximum length required for any face-name.
author Richard M. Stallman <rms@gnu.org>
date Mon, 11 Jan 1999 13:32:11 +0000
parents 82325b2dbb5e
children 4cd52e40cf31
comparison
equal deleted inserted replaced
24044:9a52ffb7bfb2 24045:094765645c52
1122 selected frame." 1122 selected frame."
1123 (interactive) 1123 (interactive)
1124 (let ((faces (sort (face-list) (function string-lessp))) 1124 (let ((faces (sort (face-list) (function string-lessp)))
1125 (face nil) 1125 (face nil)
1126 (frame (selected-frame)) 1126 (frame (selected-frame))
1127 disp-frame window) 1127 disp-frame window
1128 (face-name-max-length
1129 (car (sort (mapcar (function string-width)
1130 (mapcar (function symbol-name) (face-list)))
1131 (function >)))))
1128 (with-output-to-temp-buffer "*Faces*" 1132 (with-output-to-temp-buffer "*Faces*"
1129 (save-excursion 1133 (save-excursion
1130 (set-buffer standard-output) 1134 (set-buffer standard-output)
1131 (setq truncate-lines t) 1135 (setq truncate-lines t)
1132 (while faces 1136 (while faces
1133 (setq face (car faces)) 1137 (setq face (car faces))
1134 (setq faces (cdr faces)) 1138 (setq faces (cdr faces))
1135 (insert (format "%25s " (symbol-name face))) 1139 (insert (format
1140 (format "%%-%ds "
1141 face-name-max-length)
1142 (symbol-name face)))
1136 (let ((beg (point))) 1143 (let ((beg (point)))
1137 (insert list-faces-sample-text) 1144 (insert list-faces-sample-text)
1138 (insert "\n") 1145 (insert "\n")
1139 (put-text-property beg (1- (point)) 'face face) 1146 (put-text-property beg (1- (point)) 'face face)
1140 ;; If the sample text has multiple lines, line up all of them. 1147 ;; If the sample text has multiple lines, line up all of them.