From xemacs-m  Sun Mar 23 02:19:07 1997
Received: from GS213.SP.CS.CMU.EDU (GS213.SP.CS.CMU.EDU [128.2.209.183])
	by xemacs.org (8.8.5/8.8.5) with SMTP id CAA04484
	for <xemacs-beta@xemacs.org>; Sun, 23 Mar 1997 02:19:07 -0600 (CST)
Received: by GS213.SP.CS.CMU.EDU (AIX 3.2/UCB 5.64/4.03)
          id AA15035; Sun, 23 Mar 1997 03:19:00 -0500
Date: Sun, 23 Mar 1997 03:19:00 -0500
Message-Id: <9703230819.AA15035@GS213.SP.CS.CMU.EDU>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Darrell Kindred <dkindred@cmu.edu>
To: derrell@vis-av.com
Cc: XEmacs Beta List <xemacs-beta@xemacs.org>
Subject: Re: determining face
Organization: Carnegie Mellon University School of Computer Science
In-Reply-To: <199703230139.UAA09605@amber.vis-av.com>
References: <199703230139.UAA09605@amber.vis-av.com>
X-Mailer: VM 6.22 under 19.15 XEmacs Lucid (beta103)

Derrell Lipman writes:
 > Is there any way to determine the face used to display text in a
 > window?  I'm looking for any method to do this, but the nicest would
 > be to move the mouse pointer over some text and then say
 > 
 > 	M-x what-face
 > 
 > or some such thing.  Is there anything vaguely like this, either
 > mouse-driven or cursor driven?

I threw the following together a few weeks ago.  The
commented-out version doesn't work, perhaps because of a bug
in extent-properties-at.

- Darrell

;;; This doesn't seem to work if multiple faces are active
;;; (e.g. bold/italic)
;;; Bug in extent-properties-at?
;;; (defun dk::what-faces ()
;;;  (interactive)
;;;  (let ((faces (plist-get (extent-properties-at (point))
;;;			 'face)))
;;;    (message "faces at point: %s" faces)))

(defun dk::what-faces ()
  "give a message showing what faces the extents at point have"
  (interactive)
  (let ((fs nil))
    (map-extents
     (lambda (e m) 
       (let ((faces (extent-face e))) 
	 (setq fs (if (listp faces) (append faces fs) (cons faces fs))))
       nil)
     (current-buffer)
     (point)
     (point))
    (message "faces at point: %s" fs)
    fs))

