emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] babel completion notification


From: Eric Schulte
Subject: Re: [O] babel completion notification
Date: Mon, 17 Mar 2014 19:07:47 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Nick Dokos <address@hidden> writes:

> Ken Mankoff <address@hidden> writes:
>
>> Hi Eric,
>>
>> On 2014-03-17 at 17:05, Eric Schulte wrote:
>>> Ken Mankoff <address@hidden> writes:
>>>
>>>> Until asynchronous babel exists, it would be nice to at least be
>>>> notified when long-running tasks complete. Does anyone have advice
>>>> how to set up a hook on babel completion so that growl or some
>>>> other system notification alerts, perhaps only if the execution
>>>> took more than x seconds?
>>>
>>> You can use the org-babel-after-execute-hook to run any action after a
>>> code block finishes executing.
>>
>> Yes, and your reply makes me recall that :post works too, so I can
>> call a shell command "notifier" (or Growl) like this:
>>  
>> #+BEGIN_SRC python -n :results output :post (shell-command-to-string 
>> "notifier 'babel done'")
>> print "hello, world"
>> #+END_SRC
>> #+RESULTS:
>>
>
> The :post method does not seem to work for me. With:
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_SRC sh :results output  :post (shell-command-to-string "popup.py 
> babel done")
> sleep 10
> echo DONE
> #+END_SRC
> --8<---------------cut here---------------end--------------->8---
>
> (popup.py is my homemade notifier)

Try adding `(lambda () (shell-command-to-string "popup.py babel done"))'
to your `org-babel-after-execute-hook'.

> 
> I get the popup immediately and the results after 10 seconds.  The
> org-babel-after-execute-hook method worked fine.
>

That is probably because the elisp form in the :post value is executed
at header-argument parse time before the code block is executed.  If
instead your use a code block name as your post header argument it will
only be evaluated after the code block finishes.

Best,

>
> Nick
>
>
>
>
>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



reply via email to

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