unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* automatically rebuild TAGS tables on M-.
@ 2003-09-03  0:43 Jeff D. Hamann
  2003-09-03  9:42 ` Felix Natter
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff D. Hamann @ 2003-09-03  0:43 UTC (permalink / raw)


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-.?

Jeff.


---
Jeff D. Hamann
Hamann, Donald and Associates, Inc.
PO Box 1421
Corvallis, Oregon USA 97339-1421
(office) 541-753-7333
(cell) 541-740-5988
jeff_hamann@hamanndonald.com
www.hamanndonald.com

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

* Re: automatically rebuild TAGS tables on M-.
  2003-09-03  0:43 automatically rebuild TAGS tables on M- Jeff D. Hamann
@ 2003-09-03  9:42 ` Felix Natter
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Natter @ 2003-09-03  9:42 UTC (permalink / raw)


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

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

end of thread, other threads:[~2003-09-03  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-03  0:43 automatically rebuild TAGS tables on M- Jeff D. Hamann
2003-09-03  9:42 ` Felix Natter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).