all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Question about font-lock faces
@ 2007-02-28 14:50 Hadron
  2007-02-28 15:30 ` Robert D. Crawford
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Hadron @ 2007-02-28 14:50 UTC (permalink / raw)
  To: help-gnu-emacs


Is it possible to interactively query whyt "face" a certain word is
using in a font-lock mode?

e.g I am in html-helper-mode and in the following text

<table class="main" align=CENTER>

the word "class" is dark blue and almost unreadable. There are no blue
settings in the customization of html-helper-faces so it is picking it
up from elsewhere. Ditto for certain words in C code when in c-mode.

So my question is : how to find out which "face" a word is being
decorated with?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-02-28 14:50 Hadron
@ 2007-02-28 15:30 ` Robert D. Crawford
  2007-02-28 15:53   ` Hadron
                     ` (3 more replies)
  2007-02-28 15:49 ` Kim F. Storm
       [not found] ` <mailman.220.1172677737.7795.help-gnu-emacs@gnu.org>
  2 siblings, 4 replies; 15+ messages in thread
From: Robert D. Crawford @ 2007-02-28 15:30 UTC (permalink / raw)
  To: help-gnu-emacs

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.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-02-28 14:50 Hadron
  2007-02-28 15:30 ` Robert D. Crawford
@ 2007-02-28 15:49 ` Kim F. Storm
       [not found] ` <mailman.220.1172677737.7795.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 15+ messages in thread
From: Kim F. Storm @ 2007-02-28 15:49 UTC (permalink / raw)
  To: help-gnu-emacs

Hadron <hadronquark@gmail.com> writes:

> So my question is : how to find out which "face" a word is being
> decorated with?

C-u C-x =

-- 
Kim F. Storm  http://www.cua.dk

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-02-28 15:30 ` Robert D. Crawford
@ 2007-02-28 15:53   ` Hadron
  2007-02-28 17:33   ` Stefan Monnier
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Hadron @ 2007-02-28 15:53 UTC (permalink / raw)
  To: help-gnu-emacs

"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

worked great! thanks. font-lock-variable-name-face it was. Couldnt
customise it from the variable query though which surprised me. But
could do from edit/text/display faces.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
       [not found] ` <mailman.220.1172677737.7795.help-gnu-emacs@gnu.org>
@ 2007-02-28 16:04   ` Hadron
  0 siblings, 0 replies; 15+ messages in thread
From: Hadron @ 2007-02-28 16:04 UTC (permalink / raw)
  To: help-gnu-emacs

no-spam@cua.dk (Kim F. Storm) writes:

> Hadron <hadronquark@gmail.com> writes:
>
>> So my question is : how to find out which "face" a word is being
>> decorated with?
>
> C-u C-x =

even better. Thanks.

what-cursor-position

and can customise the font directly from the resulting details sheet.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  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 14:14   ` Chris McMahan
  2007-03-01 17:16   ` Drew Adams
  3 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2007-02-28 17:33 UTC (permalink / raw)
  To: help-gnu-emacs

> (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
>                " "))))

You're probably better off using `get-char-property' directly (which also
knows to select the right overlay based on priorities).


        Stefan

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-02-28 17:33   ` Stefan Monnier
@ 2007-03-01  0:25     ` Robert D. Crawford
  2007-03-01  1:16       ` Hadron
  0 siblings, 1 reply; 15+ messages in thread
From: Robert D. Crawford @ 2007-03-01  0:25 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> (defun rdc-show-face-at-point ()

> You're probably better off using `get-char-property' directly (which also
> knows to select the right overlay based on priorities).

Yeah, I figured there was probably a better way.  This was just the
quick and dirty solution.  I figured others, more knowledgeable in the
Tao of Emacs, would chime in with the "real" solution.

Thanks,
rdc
-- 
Robert D. Crawford                                      rdc1x@comcast.net

Reading is to the mind what exercise is to the body.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-03-01  0:25     ` Robert D. Crawford
@ 2007-03-01  1:16       ` Hadron
  2007-03-01  2:28         ` Robert D. Crawford
  0 siblings, 1 reply; 15+ messages in thread
From: Hadron @ 2007-03-01  1:16 UTC (permalink / raw)
  To: help-gnu-emacs

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

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> (defun rdc-show-face-at-point ()
>
>> You're probably better off using `get-char-property' directly (which also
>> knows to select the right overlay based on priorities).
>
> Yeah, I figured there was probably a better way.  This was just the
> quick and dirty solution.  I figured others, more knowledgeable in the
> Tao of Emacs, would chime in with the "real" solution.

That was quick and dirty? Wow, you must talk lisp in your sleep. Yeth?
:)

>
> Thanks,
> rdc

-- 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-03-01  1:16       ` Hadron
@ 2007-03-01  2:28         ` Robert D. Crawford
  0 siblings, 0 replies; 15+ messages in thread
From: Robert D. Crawford @ 2007-03-01  2:28 UTC (permalink / raw)
  To: help-gnu-emacs

Hadron <hadronquark@gmail.com> writes:

> That was quick and dirty? Wow, you must talk lisp in your sleep. Yeth?

I cannot really take credit for that code.  It was probably written by
Dr. T. V. Raman of the emacspeak project.  I think I mentioned this in
my first post.  All I did was to remove the small bit that you would
have had no use for, the part that tells me what voice is being used on
the text at point.

Take care,
rdc
-- 
Robert D. Crawford                                      rdc1x@comcast.net

Real programmers can write assembly code in any language.   :-)
		-- Larry Wall in  <8571@jpl-devvax.JPL.NASA.GOV>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-02-28 15:30 ` Robert D. Crawford
  2007-02-28 15:53   ` Hadron
  2007-02-28 17:33   ` Stefan Monnier
@ 2007-03-01 14:14   ` Chris McMahan
  2007-03-01 14:48     ` Lennart Borgman (gmail)
  2007-03-01 17:16   ` Drew Adams
  3 siblings, 1 reply; 15+ messages in thread
From: Chris McMahan @ 2007-03-01 14:14 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-03-01 14:14   ` Chris McMahan
@ 2007-03-01 14:48     ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 15+ messages in thread
From: Lennart Borgman (gmail) @ 2007-03-01 14:48 UTC (permalink / raw)
  Cc: help-gnu-emacs

Chris McMahan wrote:
> 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))))


Nice, but (point) should be pos in the code above.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: Question about font-lock faces
  2007-02-28 15:30 ` Robert D. Crawford
                     ` (2 preceding siblings ...)
  2007-03-01 14:14   ` Chris McMahan
@ 2007-03-01 17:16   ` Drew Adams
  2007-03-01 17:33     ` Lennart Borgman (gmail)
  3 siblings, 1 reply; 15+ messages in thread
From: Drew Adams @ 2007-03-01 17:16 UTC (permalink / raw)
  To: help-gnu-emacs

> > Is it possible to interactively query what "face" a certain word is
> > using in a font-lock mode?

Kim answered this best, if you want the text-property info at the current
cursor position: `C-u C-x ='.

You might also be interested in this, however, if you don't want to move the
text cursor to the text you want the properties of - just point and click
the mouse:
http://www.emacswiki.org/cgi-bin/wiki/FaceMenuPlus#TextPropertiesMenu.

Hold Control and click `mouse-2', then pick Describe Properties in the popup
menu. You'll see the text properties for the character you clicked.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
  2007-03-01 17:16   ` Drew Adams
@ 2007-03-01 17:33     ` Lennart Borgman (gmail)
  2007-03-01 17:41       ` Drew Adams
  0 siblings, 1 reply; 15+ messages in thread
From: Lennart Borgman (gmail) @ 2007-03-01 17:33 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

Drew Adams wrote:
>>> Is it possible to interactively query what "face" a certain word is
>>> using in a font-lock mode?
> 
> Kim answered this best, if you want the text-property info at the current
> cursor position: `C-u C-x ='.

Ah, nice, I have forgotten that one. But there are bugs on that display. 
Some links uses mouse-1 and other mouse-2.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: Question about font-lock faces
  2007-03-01 17:33     ` Lennart Borgman (gmail)
@ 2007-03-01 17:41       ` Drew Adams
  0 siblings, 0 replies; 15+ messages in thread
From: Drew Adams @ 2007-03-01 17:41 UTC (permalink / raw)
  To: help-gnu-emacs

> >>> Is it possible to interactively query what "face" a certain word is
> >>> using in a font-lock mode?
> >
> > Kim answered this best, if you want the text-property info at
> > the current cursor position: `C-u C-x ='.
>
> Ah, nice, I have forgotten that one. But there are bugs on that display.
> Some links uses mouse-1 and other mouse-2.

I should have mentioned that showing text properties is for Emacs 22, not 20
or 21.

Lennart, you know how to report bugs: Help > Send Bug Report.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Question about font-lock faces
       [not found] <mailman.263.1172770923.7795.help-gnu-emacs@gnu.org>
@ 2007-03-02  1:31 ` Johan Bockgård
  0 siblings, 0 replies; 15+ messages in thread
From: Johan Bockgård @ 2007-03-02  1:31 UTC (permalink / raw)
  To: help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> writes:

>>> Kim answered this best, if you want the text-property info at
>>> the current cursor position: `C-u C-x ='.
>
> I should have mentioned that showing text properties is for Emacs
> 22, not 20 or 21.

In Emacs < 22 use M-x list-text-properties-at

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-03-02  1:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.263.1172770923.7795.help-gnu-emacs@gnu.org>
2007-03-02  1:31 ` Question about font-lock faces Johan Bockgård
2007-02-28 14:50 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
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.