help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Question about font-lock faces


From: Chris McMahan
Subject: Re: Question about font-lock faces
Date: Thu, 01 Mar 2007 09:14:07 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.94 (windows-nt)

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
  =================================================


reply via email to

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