From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Rettke Subject: Re: babel completion notification Date: Tue, 18 Mar 2014 21:00:47 -0500 Message-ID: References: <87iorcwn6g.fsf@gmail.com> <87lhw8wkhz.fsf@alphaville.bos.redhat.com> <87eh20wbz0.fsf@gmail.com> <874n2w1azw.fsf@gmail.com> <8738ifwpam.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c352a470b7fe04f4ec0578 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQ5oJ-00022k-6y for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 22:00:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQ5oH-0004IH-OX for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 22:00:51 -0400 Received: from mail-la0-x229.google.com ([2a00:1450:4010:c03::229]:60579) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQ5oH-0004ID-Au for emacs-orgmode@gnu.org; Tue, 18 Mar 2014 22:00:49 -0400 Received: by mail-la0-f41.google.com with SMTP id gl10so5396779lab.14 for ; Tue, 18 Mar 2014 19:00:47 -0700 (PDT) In-Reply-To: <8738ifwpam.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Nick Dokos , "emacs-orgmode@gnu.org" --001a11c352a470b7fe04f4ec0578 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The other options are prettier and the hook is more flexible; I had only cared about tangling though so I set this: (defadvice org-babel-tangle (before org-babel-tangle-before activate) (message (concat "org-babel-tangle BEFORE: <" (format-time-string "%Y-%m-%dT%T%z") ">"))) (defadvice org-babel-tangle (after org-babel-tangle-after activate) (message (concat "org-babel-tangle AFTER: <" (format-time-string "%Y-%m-%dT%T%z") ">"))) For some reason couldn't get around advice working here, it was just never run. On Tue, Mar 18, 2014 at 9:32 AM, Eric Schulte wrote= : > > However, there is a problem: > > > > --8<---------------cut here---------------start------------->8--- > > #+name: notify > > #+BEGIN_SRC emacs-lisp :results none > > (shell-command "popup.py DONE") > > #+END_SRC > > > > #+name: long-running > > #+BEGIN_SRC shell :results output :post notify > > sleep 5 > > echo DONE > > #+END_SRC > > > > #+RESULTS: long-running > > : nil > > --8<---------------cut here---------------end--------------->8--- > > > > The result seems to be the result of the notify block, not the > > long-running one. > > Yes, that's how post blocks are supposed to work, they're normally used > to post-process results. You should add a variable to the post block > and have it return that variable, e.g., > > #+name: notify > #+begin_src emacs-lisp :var data=3D"" > (shell-command "popup.py DONE") > data > #+end_src > > -- > Eric Schulte > https://cs.unm.edu/~eschulte > PGP: 0x614CA05D > > --=20 Grant Rettke | ACM, AMA, COG, IEEE gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/ =E2=80=9CWisdom begins in wonder.=E2=80=9D --Socrates ((=CE=BB (x) (x x)) (=CE=BB (x) (x x))) =E2=80=9CLife has become immeasurably better since I have been forced to st= op taking it seriously.=E2=80=9D --Thompson --001a11c352a470b7fe04f4ec0578 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The other options are prettier and the hook is more flexib= le; I had only cared about
tangling though so I set this:
(defadvice org-babel-tangle (before org-babel-tangle-befor= e activate)
=C2=A0 (message (concat "org-babel-tangle BEFORE: <"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (format-time-string "%Y-%m-%dT%T%z")
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0">")))

(defadvice org-babel-tangle (after org-babel-tangle-a= fter activate)
=C2=A0 (message (concat "org-babel-tangle AFTER: <"
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(= format-time-string "%Y-%m-%dT%T%z")
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0">")))

For some reason couldn't get around advice working here, it was just ne= ver run.


On Tue, Mar 18, 2014 at 9:32 AM, Eric Schulte <= schulte.eric@gm= ail.com> wrote:
> However, there is a pro= blem:
>
> --8<---------------cut here---------------start------------->8--= -
> #+name: notify
> #+BEGIN_SRC emacs-lisp :results none
> (shell-command "popup.py DONE")
> #+END_SRC
>
> #+name: long-running
> #+BEGIN_SRC shell :results output :post notify
> sleep 5
> echo DONE
> #+END_SRC
>
> #+RESULTS: long-running
> : nil
> --8<---------------cut here---------------end--------------->8--= -
>
> The result seems to be the result of the notify block, not the
> long-running one.

Yes, that's how post blocks are supposed to work, they're nor= mally used
to post-process results. =C2=A0You should add a variable to the post block<= br> and have it return that variable, e.g.,

#+name: notify
#+begin_src emacs-lisp :var data=3D""
(shell-command "popup.py DONE")
data
#+end_src

--
Eric Schulte
https://cs.unm.e= du/~eschulte
PGP: 0x614CA05D




--
= Grant Rettke | ACM, AMA, COG, IEEE
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
=E2=80=9CWisdom begins in wonder.=E2=80=9D --Socrates
((=CE=BB (x) (x x)= ) (=CE=BB (x) (x x)))
=E2=80=9CLife has become immeasurably better since= I have been forced to stop taking it seriously.=E2=80=9D --Thompson
--001a11c352a470b7fe04f4ec0578--