unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Chris McMahan <first_initiallastname@one.dot.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Question about font-lock faces
Date: Thu, 01 Mar 2007 09:14:07 -0500	[thread overview]
Message-ID: <uabyxgifk.fsf@one.dot.net> (raw)
In-Reply-To: 87tzx6qoyp.fsf@comcast.net

I've been using this one from Miles Bader for some time, and it works
quite well.

- Chris

(defun what-face (pos)
  "Return the font-lock face information at the current point
Thanks to Miles Bader <miles-at-lsi.nec.co.jp> for this (gnus.emacs.help)"
  (interactive "d")
  (let ((face (or (get-char-property (point) 'read-face-name)
		  (get-char-property (point) 'face))))
    (if face
	(message "Face: %s" face)
      (message "No face at %d" pos))))



"Robert D. Crawford" <rdc1x@comcast.net> writes:

> Hadron <hadronquark@gmail.com> writes:
>
>> Is it possible to interactively query whyt "face" a certain word is
>> using in a font-lock mode?
>
> This should work.  I adapted it from a function in emacspeak and have
> tested it several times.
>
> (defun rdc-show-face-at-point ()
>   "Show value of property faceat point."
>   (interactive )
>   (let ((f (get-text-property (point) 'face))
>         (o
>          (delq nil
>                (mapcar
>                 #'(lambda (overlay)
>                     (overlay-get overlay 'face))
>                 (overlays-at (point))))))
>     (message "Face %s" f
>              (if o
>                  o
>                " "))))
>
>
> There might be a better way to do it or there might be a way built into
> emacs.  
>
> rdc
> -- 
> Robert D. Crawford                                      rdc1x@comcast.net
>
> Van Roy's Law:
> 	An unbreakable toy is useful for breaking other toys.

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================

  parent reply	other threads:[~2007-03-01 14:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-28 14:50 Question about font-lock faces Hadron
2007-02-28 15:30 ` Robert D. Crawford
2007-02-28 15:53   ` Hadron
2007-02-28 17:33   ` Stefan Monnier
2007-03-01  0:25     ` Robert D. Crawford
2007-03-01  1:16       ` Hadron
2007-03-01  2:28         ` Robert D. Crawford
2007-03-01 14:14   ` Chris McMahan [this message]
2007-03-01 14:48     ` Lennart Borgman (gmail)
2007-03-01 17:16   ` Drew Adams
2007-03-01 17:33     ` Lennart Borgman (gmail)
2007-03-01 17:41       ` Drew Adams
2007-02-28 15:49 ` Kim F. Storm
     [not found] ` <mailman.220.1172677737.7795.help-gnu-emacs@gnu.org>
2007-02-28 16:04   ` Hadron
     [not found] <mailman.263.1172770923.7795.help-gnu-emacs@gnu.org>
2007-03-02  1:31 ` Johan Bockgård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uabyxgifk.fsf@one.dot.net \
    --to=first_initiallastname@one.dot.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).