summaryrefslogtreecommitdiff
path: root/lisp/faces.el
diff options
context:
space:
mode:
authorRamprasad B <ramprasad_i82@yahoo.com>2006-10-31 09:54:01 +0000
committerRamprasad B <ramprasad_i82@yahoo.com>2006-10-31 09:54:01 +0000
commitc76cf5f8a41a43538d40235daf03e9d2fe81b40c (patch)
treec02211b33ee0f8574945c3f37703f9cad5b98ccf /lisp/faces.el
parente35fc9628ced2eafed2073622bbab1eec010d82a (diff)
downloademacs-c76cf5f8a41a43538d40235daf03e9d2fe81b40c.tar.gz
Installed describe-face sample text
Diffstat (limited to 'lisp/faces.el')
-rw-r--r--lisp/faces.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 55eca37d963..f0f3b1a8ce0 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -32,6 +32,9 @@
;; Warning suppression -- can't require x-win in batch:
(autoload 'xw-defined-colors "x-win"))
+(defvar faces-sample-overlay nil
+ "Overlay for showing an example of a face.")
+
(defvar help-xref-stack-item)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1252,6 +1255,16 @@ arg, prompt for a regular expression."
(copy-face (car faces) (car faces) frame disp-frame)
(setq faces (cdr faces)))))))
+(defun faces-sample-overlay (face)
+ "Insert sample text with FACE.
+
+If FACE is not a face or nil, use the default face."
+ (let ((f (if (facep face) face 'default))
+ (start (+ (point) 2))) ;; skip face and paren
+ (insert " (sample)")
+ (setq faces-sample-overlay (make-overlay start (1- (point))))
+ (overlay-put faces-sample-overlay 'face f)))
+
(defun describe-face (face &optional frame)
"Display the properties of face FACE on FRAME.
@@ -1293,6 +1306,7 @@ If FRAME is omitted or nil, use the selected frame."
(insert " undefined face.\n")
(let ((customize-label "customize this face")
file-name)
+ (faces-sample-overlay f)
(princ (concat " (" customize-label ")\n"))
(insert "Documentation: "
(or (face-documentation f)