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

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

Re: automatically rebuild TAGS tables on M-.


From: Felix Natter
Subject: Re: automatically rebuild TAGS tables on M-.
Date: Wed, 03 Sep 2003 11:42:43 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

"Jeff D. Hamann" <jeff_hamann@hamanndonald.com> writes:

> I've been using ctags to generate my TAGS table for a project. Is it
> possible, using some "global-key-set" like,
>
> (global-set-key [f5] 'goto-line)
>
> to have emacs automatically call ctags -r -e *.* when the user wishes to
> visit a tag when pressing M-.?

(global-set-key "\M-." '(lambda()
                          (interactive)
                          (compile "make tags")
                          (find-tag (find-tag-interactive "Find tag: "))))

If your source is using automake then there's a "tags" target,
which should be preferrable to "ctags -r -e *.*" (as shown above).

If you want to use "ctags -r -e *.*" then you may want to run this
only once per emacs-session (if you have many projects that you want
to use this for then it might be a good idea to make it buffer-local,
as in the code below):

(global-set-key "\M-." '(lambda()
                          (interactive)
                          (when (not my-ctags-is-run)
                            (shell-command "ctags -r -e *.*")
                            (setq my-ctags-is-run t)
                            (make-local-variable 'my-ctags-is-run))
                          (find-tag (find-tag-interactive "Find tag: "))))

(this is not tested)
and no, the above is not a lisp-expression ;-)

-- 
Felix Natter
Linux from *scratch* (www.gnu.org/software/emacs)


reply via email to

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