all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* build-and-load-etags
@ 2007-04-26 20:39 David L
  2007-04-26 20:42 ` build-and-load-etags Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: David L @ 2007-04-26 20:39 UTC (permalink / raw)
  To: help-gnu-emacs

I'm trying to write a function that will generate etags
and then load them, but I'm not sure how to make the
function wait for the etags building step to complete
before trying to load the etags.

I have an etags make target and I using emacs
compile to build the etags.  But it tries to load the
tags file before it finishes building.

Thanks...

        David

PS - I tried something like this:

(defun build-and-load-tags ()
  (build-etags)
  (visit-tags-table tags-file-name)
  (find-tag "main")
)

(defun build-etags ()
  (interactive)
  (compile "make etags")
  )

_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office 
Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/

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

* Re: build-and-load-etags
  2007-04-26 20:39 build-and-load-etags David L
@ 2007-04-26 20:42 ` Eli Zaretskii
  2007-04-26 21:06   ` build-and-load-etags David L
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2007-04-26 20:42 UTC (permalink / raw)
  To: help-gnu-emacs

> From: "David L" <idht4n@hotmail.com>
> Bcc: 
> Date: Thu, 26 Apr 2007 13:39:14 -0700
> 
> (defun build-etags ()
>   (interactive)
>   (compile "make etags")
     ^^^^^^^
This is your problem: `compile' runs the command asynchronously, which
is not what you want.  Use `shell-command' or some such, and Emacs will
wait.

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

* Re: build-and-load-etags
  2007-04-26 20:42 ` build-and-load-etags Eli Zaretskii
@ 2007-04-26 21:06   ` David L
  2007-04-27  8:16     ` build-and-load-etags Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: David L @ 2007-04-26 21:06 UTC (permalink / raw)
  To: help-gnu-emacs


>
> > From: "David L" <idht4n@hotmail.com>
> > Bcc:
> > Date: Thu, 26 Apr 2007 13:39:14 -0700
> >
> > (defun build-etags ()
> >   (interactive)
> >   (compile "make etags")
>      ^^^^^^^
>This is your problem: `compile' runs the command asynchronously, which
>is not what you want.  Use `shell-command' or some such, and Emacs will
>wait.
>
Thanks for the quick response!  Is there a way to get compile to run
syncrhonously?  Or alternatively to get the "next-error" functionality
when using shell-command?  The generation of my etags from my makefile
uses gcc to generate dependencies that are used as inputs to etags.  I'd 
like
to be able to use the "next-error" function when building etags in case I 
have
a typo in a #include or something.  So the function will either build and 
load
the etags or bring me to the line with the error that prevented a complete
dependency list from being generated.

Thanks again...

          David

_________________________________________________________________
MSN is giving away a trip to Vegas to see Elton John.  Enter to win today. 
http://msnconcertcontest.com?icid-nceltontagline

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

* Re: build-and-load-etags
  2007-04-26 21:06   ` build-and-load-etags David L
@ 2007-04-27  8:16     ` Eli Zaretskii
  2007-04-27 19:41       ` build-and-load-etags David L
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2007-04-27  8:16 UTC (permalink / raw)
  To: help-gnu-emacs

> From: "David L" <idht4n@hotmail.com>
> Bcc: 
> Date: Thu, 26 Apr 2007 14:06:27 -0700
> 
> Is there a way to get compile to run syncrhonously?

Not that I know of.

> Or alternatively to get the "next-error" functionality
> when using shell-command?

I think you want compilation-minor-mode.

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

* Re: build-and-load-etags
  2007-04-27  8:16     ` build-and-load-etags Eli Zaretskii
@ 2007-04-27 19:41       ` David L
  2007-04-28  2:21         ` build-and-load-etags Tom Tromey
  2007-04-28  8:03         ` build-and-load-etags Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: David L @ 2007-04-27 19:41 UTC (permalink / raw)
  To: eliz, help-gnu-emacs

> > Is there a way to get compile to run syncrhonously?
>
>Not that I know of.
>
> > Or alternatively to get the "next-error" functionality
> > when using shell-command?
>
>I think you want compilation-minor-mode.
>

That works... thanks.

One more question.  If I wanted the benefit of asynchronous
generation of the tags file (ie, not having to wait 30 seconds
for a big list of dependencies to be created before my emacs
session is active again) is there a way to query the completion
status of a compile session so I could start a timer and
poll every few seconds for compilation completion?  This
would also be useful for functions like compile-and-run or
compile-and-debug where you want to wait for compilation
to be done before proceeding with the next step (but might
want to continue browsing through the code in the mean time).


Thanks!

         David

_________________________________________________________________
Exercise your brain! Try Flexicon. 
http://games.msn.com/en/flexicon/default.htm?icid=flexicon_hmemailtaglineapril07

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

* Re: build-and-load-etags
  2007-04-27 19:41       ` build-and-load-etags David L
@ 2007-04-28  2:21         ` Tom Tromey
  2007-04-28  8:03         ` build-and-load-etags Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2007-04-28  2:21 UTC (permalink / raw)
  To: David L; +Cc: help-gnu-emacs

>>>>> "David" == David L <idht4n@hotmail.com> writes:

David> One more question.  If I wanted the benefit of asynchronous
David> generation of the tags file (ie, not having to wait 30 seconds
David> for a big list of dependencies to be created before my emacs
David> session is active again) is there a way to query the completion
David> status of a compile session so I could start a timer and
David> poll every few seconds for compilation completion?  This
David> would also be useful for functions like compile-and-run or
David> compile-and-debug where you want to wait for compilation
David> to be done before proceeding with the next step (but might
David> want to continue browsing through the code in the mean time).

You could set compilation-finish-function to do something.

Running something to start the debugger when compilation is finished
might have a weird effect -- e.g. it could pop up while you are in the
middle of something else.

FWIW I set compilation-finish-function to play a sound when the
compilation is done (with different noises for success and failure).
Then I just bury the compilation buffer and forget about it.

Tom

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

* Re: build-and-load-etags
  2007-04-27 19:41       ` build-and-load-etags David L
  2007-04-28  2:21         ` build-and-load-etags Tom Tromey
@ 2007-04-28  8:03         ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2007-04-28  8:03 UTC (permalink / raw)
  To: help-gnu-emacs

> From: "David L" <idht4n@hotmail.com>
> Bcc: 
> Date: Fri, 27 Apr 2007 12:41:47 -0700
> 
> One more question.  If I wanted the benefit of asynchronous
> generation of the tags file (ie, not having to wait 30 seconds
> for a big list of dependencies to be created before my emacs
> session is active again)

But then you will not be able to use tags commands until etags
finishes.  Since you want build-and-load-etags, this kinda doesn't
make sense, does it?

> is there a way to query the completion
> status of a compile session so I could start a timer and
> poll every few seconds for compilation completion?

You don't need to reinvent the wheel like that, since Emacs already
has the machinery to check the status of an async process.  A special
sentinel function is called when the process changes state, and
there's a hook variable `compilation-finish-functions' that you can
use to get your function called when the process exits.

Btw, the ELisp manual describes all this in quite some detail.  I
suggest to read the relevant parts of it when you are writing Lisp
programs.

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

end of thread, other threads:[~2007-04-28  8:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-26 20:39 build-and-load-etags David L
2007-04-26 20:42 ` build-and-load-etags Eli Zaretskii
2007-04-26 21:06   ` build-and-load-etags David L
2007-04-27  8:16     ` build-and-load-etags Eli Zaretskii
2007-04-27 19:41       ` build-and-load-etags David L
2007-04-28  2:21         ` build-and-load-etags Tom Tromey
2007-04-28  8:03         ` build-and-load-etags Eli Zaretskii

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.