emacs-devel
[Top][All Lists]
Advanced

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

Re: which-function => DEFUN?


From: Juanma Barranquero
Subject: Re: which-function => DEFUN?
Date: Mon, 10 May 2010 16:22:30 +0200

On Mon, May 10, 2010 at 15:58, Lennart Borgman
<address@hidden> wrote:

> It is a bit annoying to see DEFUN as the function shown by 
> which-function-mode.
>
> I am sure someone here has written an
> imenu-extract-index-name-function for use in Emacs C sources... ;-)

(defun which-func-identify-DEFUN ()
  (save-excursion
    (save-match-data
      (beginning-of-defun)
      (and (looking-at "DEFUN +(\"[^\"]+\",[ \n]+\\(F[^,]+\\),")
           (match-string-no-properties 1)))))

Likely the `save-match-data' is not required, but I tend to err on the
side of saving it on my code.

> Where is it? How do you set it up?

  (add-hook 'which-func-functions 'which-func-identify-DEFUN nil t)

on the required buffers (I set it through `c-mode-hook').

    Juanma



reply via email to

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