emacs-devel
[Top][All Lists]
Advanced

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

Re: Async commands in M-x compile


From: Dan Nicolaescu
Subject: Re: Async commands in M-x compile
Date: Wed, 30 Jun 2010 18:36:56 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Antoine Levitt <address@hidden> writes:

> Ken Raeburn <address@hidden> writes:
>
>> On Jun 29, 2010, at 18:43, Antoine Levitt wrote:
>>> Hello,
>>> 
>>> Can someone explain to me why compile doesn't support asynchroneous
>>> commands, and especially why it silently fails instead of displaying an
>>> error message? I don't understand the mechanism involved here.
>>
>> The program run -- the shell -- exits (after having started some other
>> program in background).  The compilation command has finished, and
>> exited with an exit status that indicates success.  So, you're done.
>> I could argue that it "succeeded", though apparently not at doing
>> whatever it is that you think it should do.
>
> Yes, I would completely agree with that, except it _doesn't_ start the
> program. Try running "xclock &"
>
>>
>>> As a test, try M-x compile with "echo test > ~/test &" or "xclock &".
>>
>> Why would you need something like that?  Compilation mode already lets
>> you continue doing stuff in Emacs while the compilation runs.  And you
>> can use something like "make -j" to run multiple tasks in parallel,
>> without losing track of the exit statuses of subprocesses, like you
>> would with "&".
>>
>> If you're not actually trying to do compilation, but just run some
>> task in background without monitoring its progress or parsing error
>> messages after failure, there's shell-mode, or you can give
>> shell-command (M-!) a command ending with "&".
>
> Well, to be fair, I'm actually using compilation for another purpose
> than what it was built for. I want to perform the action "compile latex,
> if there is already a viewer, bring it to the front, if not, run one",
> ie,
>
> rubber -d main && (wmctrl -a main.pdf || gnome-open main.pdf &)

Have you tried AUCTeX?  It should be able to do this by default ...
Alternatively, you can use the infrastructure in tex.el to accomplish
what you want.



reply via email to

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