comparison lisp/faces.el @ 73580:3d1a581627ea

Installed describe-face sample text
author Ramprasad B <ramprasad_i82@yahoo.com>
date Tue, 31 Oct 2006 09:54:01 +0000
parents 3931d05c811a
children 1d779fbeeaef
comparison
equal deleted inserted replaced
73579:253ddf6ac03a 73580:3d1a581627ea
29 29
30 (eval-when-compile 30 (eval-when-compile
31 (require 'cl) 31 (require 'cl)
32 ;; Warning suppression -- can't require x-win in batch: 32 ;; Warning suppression -- can't require x-win in batch:
33 (autoload 'xw-defined-colors "x-win")) 33 (autoload 'xw-defined-colors "x-win"))
34
35 (defvar faces-sample-overlay nil
36 "Overlay for showing an example of a face.")
34 37
35 (defvar help-xref-stack-item) 38 (defvar help-xref-stack-item)
36 39
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38 ;;; Font selection. 41 ;;; Font selection.
1250 (let ((faces (face-list))) 1253 (let ((faces (face-list)))
1251 (while faces 1254 (while faces
1252 (copy-face (car faces) (car faces) frame disp-frame) 1255 (copy-face (car faces) (car faces) frame disp-frame)
1253 (setq faces (cdr faces))))))) 1256 (setq faces (cdr faces)))))))
1254 1257
1258 (defun faces-sample-overlay (face)
1259 "Insert sample text with FACE.
1260
1261 If FACE is not a face or nil, use the default face."
1262 (let ((f (if (facep face) face 'default))
1263 (start (+ (point) 2))) ;; skip face and paren
1264 (insert " (sample)")
1265 (setq faces-sample-overlay (make-overlay start (1- (point))))
1266 (overlay-put faces-sample-overlay 'face f)))
1267
1255 1268
1256 (defun describe-face (face &optional frame) 1269 (defun describe-face (face &optional frame)
1257 "Display the properties of face FACE on FRAME. 1270 "Display the properties of face FACE on FRAME.
1258 Interactively, FACE defaults to the faces of the character after point 1271 Interactively, FACE defaults to the faces of the character after point
1259 and FRAME defaults to the selected frame. 1272 and FRAME defaults to the selected frame.
1291 (insert "Face: " (symbol-name f)) 1304 (insert "Face: " (symbol-name f))
1292 (if (not (facep f)) 1305 (if (not (facep f))
1293 (insert " undefined face.\n") 1306 (insert " undefined face.\n")
1294 (let ((customize-label "customize this face") 1307 (let ((customize-label "customize this face")
1295 file-name) 1308 file-name)
1309 (faces-sample-overlay f)
1296 (princ (concat " (" customize-label ")\n")) 1310 (princ (concat " (" customize-label ")\n"))
1297 (insert "Documentation: " 1311 (insert "Documentation: "
1298 (or (face-documentation f) 1312 (or (face-documentation f)
1299 "Not documented as a face.") 1313 "Not documented as a face.")
1300 "\n") 1314 "\n")