emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

address@hidden: etc/TODO item: describe-face sample text]


From: Richard Stallman
Subject: address@hidden: etc/TODO item: describe-face sample text]
Date: Mon, 30 Oct 2006 19:18:28 -0500

This is so simple, would someone please install it now?
It is a tiny change.

------- Start of forwarded message -------
From: Yoni Rabkin Katzenell <address@hidden>
To: address@hidden
Mail-Followup-To: address@hidden
Date: Mon, 30 Oct 2006 17:33:21 +0200
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Subject: etc/TODO item: describe-face sample text
X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO 
        autolearn=failed version=3.0.4

- --=-=-=


Hello,

I sent this patch on 2006-10-15. Drew Adams commented on it but no-one
else has since, so I'm re-sending it.

I hope that I'm not being too hasty in re-sending, because of the
pretest there must be lot to do. But I'm guessing that since this is
listed as a TODO item, it would be OK.

If it would be better that I resend this after 22 is out, please say so.

The following is my original email:

emacs/etc/TODO says: "describe-face should show an example of text in
the face."

The attached patch against `faces.el' adds the word "sample", rendered
in the appropriate face, to the top row of the `describe-face' pop-up
buffer.

An example result can be seen in this screenshot:
http://yrk.nfshost.com/images/faces-sample.png


- --=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=describe_face.patch

Index: faces.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/faces.el,v
retrieving revision 1.354
diff -u -r1.354 faces.el
- --- faces.el  14 Sep 2006 23:54:44 -0000      1.354
+++ faces.el    16 Oct 2006 19:52:28 -0000
@@ -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)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1253,6 +1256,17 @@
            (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.
 Interactively, FACE defaults to the faces of the character after point
@@ -1293,6 +1307,7 @@
              (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)

- --=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel
- --=-=-=--
------- End of forwarded message -------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]