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

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

Re: Interrogating which face is being used


From: Andy Stewart
Subject: Re: Interrogating which face is being used
Date: Fri, 17 Jul 2009 23:11:21 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Tim Visher <tim.visher@gmail.com> writes:

Hi Tim,
> Hello Everyone,
>
> I'm wondering if it's possible to interrogate the entity under point
> to discover which face is currently being used to control its display.
>
> Thanks!

(defun find-function-or-variable-at-point (&optional prefix)
  "Find function or variable define at current point."
  (interactive "P")
  (if (equal 0 (variable-at-point))     ;if have not variable at current point
      (if (function-called-at-point)    ;if have function call at current point
          (call-interactively (if (null prefix) 'find-function 
'find-function-other-window))
        (if (face-at-point)             ;if have face define at current point
            (call-interactively (if (null prefix) 'find-face-definition 
'find-face-definition-other-window))
          (message "Nothing at point.")))
    (call-interactively (if (null prefix) 'find-variable 
'find-variable-other-window))))

(defun find-face-definition-other-window (face)
  "Find FACE definition at other window."
  (interactive (find-function-read 'defface))
  (find-function-do-it face 'defface 'switch-to-buffer-other-window))

Above is my smart function for find function, variable, face define
around point.

Just binding some key with function
`find-function-or-variable-at-point`.

Enjoy!

  -- Andy





reply via email to

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