all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Nick Dokos <ndokos@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: babel completion notification
Date: Mon, 17 Mar 2014 19:07:47 -0600	[thread overview]
Message-ID: <87eh20wbz0.fsf@gmail.com> (raw)
In-Reply-To: <87lhw8wkhz.fsf@alphaville.bos.redhat.com> (Nick Dokos's message of "Mon, 17 Mar 2014 18:03:36 -0400")

Nick Dokos <ndokos@gmail.com> writes:

> Ken Mankoff <mankoff@gmail.com> writes:
>
>> Hi Eric,
>>
>> On 2014-03-17 at 17:05, Eric Schulte wrote:
>>> Ken Mankoff <mankoff@gmail.com> 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	other threads:[~2014-03-18  1:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17 20:33 babel completion notification Ken Mankoff
2014-03-17 21:05 ` Eric Schulte
2014-03-17 21:39   ` Ken Mankoff
2014-03-17 22:03     ` Nick Dokos
2014-03-18  1:07       ` Eric Schulte [this message]
2014-03-18  2:44         ` Nick Dokos
2014-03-18 14:32           ` Eric Schulte
2014-03-19  2:00             ` Grant Rettke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eh20wbz0.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ndokos@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.