* [babel] ledger tutorial on Worg
@ 2010-08-26 23:06 Eric S Fraga
2010-08-27 14:53 ` Carsten Dominik
0 siblings, 1 reply; 23+ messages in thread
From: Eric S Fraga @ 2010-08-26 23:06 UTC (permalink / raw)
To: org-mode mailing list
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
Hello,
I have just placed on Worg [1] a short tutorial/example for using
ledger with babel. Please have a look and comment etc!
Thanks,
eric
[1] Hopefully at
http://orgmode.org/worg/org-contrib/babel/examples/ledger.php
when the php file is eventually created by the automated system.
[-- Attachment #2: Type: text/plain, Size: 75 bytes --]
--
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-08-26 23:06 [babel] ledger tutorial on Worg Eric S Fraga
@ 2010-08-27 14:53 ` Carsten Dominik
2010-08-27 15:27 ` Eric Schulte
0 siblings, 1 reply; 23+ messages in thread
From: Carsten Dominik @ 2010-08-27 14:53 UTC (permalink / raw)
To: Eric S Fraga; +Cc: org-mode mailing list
Hi Eric,
the example directory is not published. If you want to
get this published, please move it into the org-tutorials directory
and link to it from the index page in that directory.
Thanks!
- Carsten
On Aug 27, 2010, at 1:06 AM, Eric S Fraga wrote:
> Hello,
>
> I have just placed on Worg [1] a short tutorial/example for using
> ledger with babel. Please have a look and comment etc!
>
> Thanks,
> eric
>
>
> [1] Hopefully at
> http://orgmode.org/worg/org-contrib/babel/examples/ledger.php
> when the php file is eventually created by the automated system.
> --
> Eric S Fraga
> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-08-27 14:53 ` Carsten Dominik
@ 2010-08-27 15:27 ` Eric Schulte
2010-08-27 19:33 ` Eric S Fraga
2010-09-01 11:25 ` Sébastien Vauban
0 siblings, 2 replies; 23+ messages in thread
From: Eric Schulte @ 2010-08-27 15:27 UTC (permalink / raw)
To: Carsten Dominik; +Cc: org-mode mailing list
Hi Eric,
I hope you don't mind, I've taken the liberty of moving this tutorial
into the languages directory, and linking to it from the Babel supported
languages page [1]. I'd like to move towards having an introductory
tutorial for every language present in this directory. Once Worg
refreshes these changes should appear.
Thanks for contributing the tutorial! -- Eric
Carsten Dominik <carsten.dominik@gmail.com> writes:
> Hi Eric,
>
> the example directory is not published. If you want to
> get this published, please move it into the org-tutorials directory
> and link to it from the index page in that directory.
>
> Thanks!
>
> - Carsten
>
>
> On Aug 27, 2010, at 1:06 AM, Eric S Fraga wrote:
>
>> Hello,
>>
>> I have just placed on Worg [1] a short tutorial/example for using
>> ledger with babel. Please have a look and comment etc!
>>
>> Thanks,
>> eric
>>
>>
>> [1] Hopefully at
>> http://orgmode.org/worg/org-contrib/babel/examples/ledger.php
>> when the php file is eventually created by the automated system.
>> --
>> Eric S Fraga
>> GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> - Carsten
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Footnotes:
[1] http://orgmode.org/worg/org-contrib/babel/languages.php#langs
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-08-27 15:27 ` Eric Schulte
@ 2010-08-27 19:33 ` Eric S Fraga
2010-09-01 11:25 ` Sébastien Vauban
1 sibling, 0 replies; 23+ messages in thread
From: Eric S Fraga @ 2010-08-27 19:33 UTC (permalink / raw)
To: Eric Schulte; +Cc: org-mode mailing list, Carsten Dominik
[-- Attachment #1: Type: text/plain, Size: 629 bytes --]
On Fri, 27 Aug 2010 09:27:07 -0600, "Eric Schulte" <schulte.eric@gmail.com> wrote:
>
> Hi Eric,
>
> I hope you don't mind, I've taken the liberty of moving this tutorial
> into the languages directory, and linking to it from the Babel supported
> languages page [1]. I'd like to move towards having an introductory
> tutorial for every language present in this directory. Once Worg
> refreshes these changes should appear.
This is perfectly fine with me. Sounds like a reasonable structure.
I probably should have asked before simply putting stuff in!
> Thanks for contributing the tutorial! -- Eric
You're very welcome.
[-- Attachment #2: Type: text/plain, Size: 75 bytes --]
--
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-08-27 15:27 ` Eric Schulte
2010-08-27 19:33 ` Eric S Fraga
@ 2010-09-01 11:25 ` Sébastien Vauban
2010-09-01 18:33 ` Eric S Fraga
1 sibling, 1 reply; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-01 11:25 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
>>> I have just placed on Worg [1] a short tutorial/example for using
>>> ledger with babel. Please have a look and comment etc!
>
> [1] http://orgmode.org/worg/org-contrib/babel/languages.php#langs
Being interested a lot in Ledger integration with Org-Babel as well, I have a
quick remark: instead of including (with explicit full path) the journal
entries in every code block, can't we use the more natural (at least, to me)
tangling provided by the Noweb syntax?
Something like:
--8<---------------cut here---------------start------------->8---
* Journal data
#+src_name ledger-journal
#+begin_src ledger :results silent
2008/01/03 * (SCORPIOS) SEB VAUBAN
Assets:Bank:Checking:799979450003 550.00 EUR
Assets:Bank:Transferred
2008/01/01 * ( ) UNKNOWN-PAYEE
Assets:Bank:Checking:799979450003 21.91 EUR
Expenses:Unknown
#+end_src
* Balance
Give me an overview...
#+srcname: ledger-balance
#+begin_src ledger :cmdline "bal" :noweb
<<ledger-journal>>
#+end_src
--8<---------------cut here---------------end--------------->8---
Though this should work as far as I understand, it does not yet...
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-01 11:25 ` Sébastien Vauban
@ 2010-09-01 18:33 ` Eric S Fraga
2010-09-02 0:19 ` Eric Schulte
2010-09-02 12:43 ` Sébastien Vauban
0 siblings, 2 replies; 23+ messages in thread
From: Eric S Fraga @ 2010-09-01 18:33 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1821 bytes --]
On Wed, 01 Sep 2010 13:25:35 +0200, Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:
>
> Hi Eric,
>
> >>> I have just placed on Worg [1] a short tutorial/example for using
> >>> ledger with babel. Please have a look and comment etc!
> >
> > [1] http://orgmode.org/worg/org-contrib/babel/languages.php#langs
>
> Being interested a lot in Ledger integration with Org-Babel as well, I have a
> quick remark: instead of including (with explicit full path) the journal
> entries in every code block, can't we use the more natural (at least, to me)
> tangling provided by the Noweb syntax?
>
> Something like:
>
> --8<---------------cut here---------------start------------->8---
> * Journal data
>
> #+src_name ledger-journal
> #+begin_src ledger :results silent
> 2008/01/03 * (SCORPIOS) SEB VAUBAN
> Assets:Bank:Checking:799979450003 550.00 EUR
> Assets:Bank:Transferred
>
> 2008/01/01 * ( ) UNKNOWN-PAYEE
> Assets:Bank:Checking:799979450003 21.91 EUR
> Expenses:Unknown
> #+end_src
>
> * Balance
>
> Give me an overview...
>
> #+srcname: ledger-balance
> #+begin_src ledger :cmdline "bal" :noweb
> <<ledger-journal>>
> #+end_src
> --8<---------------cut here---------------end--------------->8---
>
> Though this should work as far as I understand, it does not yet...
>
> Best regards,
> Seb
Yes, I would have thought that this would work. It doesn't fit in
naturally with how I would like to do things as I have many different
blocks of ledger entries spread around the file...
In any case, I will try to see why this doesn't work as I have used
the :noweb approach for other babel codes successfully and cannot see
any reason why ledger would be different. Added to my todo
list... :-)
[-- Attachment #2: Type: text/plain, Size: 75 bytes --]
--
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-01 18:33 ` Eric S Fraga
@ 2010-09-02 0:19 ` Eric Schulte
2010-09-02 12:43 ` Sébastien Vauban
1 sibling, 0 replies; 23+ messages in thread
From: Eric Schulte @ 2010-09-02 0:19 UTC (permalink / raw)
To: e.fraga; +Cc: Sébastien Vauban, emacs-orgmode
Hi,
I believe this is a simple problem with your noweb header argument, see
below...
Eric S Fraga <ucecesf@ucl.ac.uk> writes:
> On Wed, 01 Sep 2010 13:25:35 +0200, Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:
[...]
>> #+srcname: ledger-balance
>> #+begin_src ledger :cmdline "bal" :noweb
the header argument line above should be ":noweb yes" instead of just
":noweb"
Best -- Eric
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-01 18:33 ` Eric S Fraga
2010-09-02 0:19 ` Eric Schulte
@ 2010-09-02 12:43 ` Sébastien Vauban
2010-09-02 14:56 ` Eric Schulte
2010-09-03 8:33 ` Eric S Fraga
1 sibling, 2 replies; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-02 12:43 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric(s) and Dan,
Eric S Fraga wrote:
> On Wed, 01 Sep 2010 13:25:35 +0200, Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:
>>>>> I have just placed on Worg [1] a short tutorial/example for using
>>>>> ledger with babel. Please have a look and comment etc!
>>>
>>> [1] http://orgmode.org/worg/org-contrib/babel/languages.php#langs
>>
>> Being interested a lot in Ledger integration with Org-Babel as well, I have a
>> quick remark: instead of including (with explicit full path) the journal
>> entries in every code block, can't we use the more natural (at least, to me)
>> tangling provided by the Noweb syntax?
>>
>> Something like:
>>
>> --8<---------------cut here---------------start------------->8---
>> * Journal data
>>
>> #+src_name ledger-journal
>> #+begin_src ledger :results silent
>> 2008/01/03 * (SCORPIOS) SEB VAUBAN
>> Assets:Bank:Checking:799979450003 550.00 EUR
>> Assets:Bank:Transferred
>>
>> 2008/01/01 * ( ) UNKNOWN-PAYEE
>> Assets:Bank:Checking:799979450003 21.91 EUR
>> Expenses:Unknown
>> #+end_src
>>
>> * Balance
>>
>> Give me an overview...
>>
>> #+srcname: ledger-balance
>> #+begin_src ledger :cmdline "bal" :noweb
>> <<ledger-journal>>
>> #+end_src
>> --8<---------------cut here---------------end--------------->8---
>
> Yes, I would have thought that this would work. It doesn't fit in naturally
> with how I would like to do things as I have many different blocks of ledger
> entries spread around the file...
I don't understand your argument: why wouldn't you use <<journal-home>> blocks
and <<journal-work>> blocks for example, or even much more? What am I missing?
What cannot be done with the noweb syntax in your Org file? I find it much
better if we can avoid specifying explicit paths, in order to guarantee use
and execution of our Org files by other users, on other (even Windows)
machines, among others.
> In any case, I will try to see why this doesn't work as I have used
> the :noweb approach for other babel codes successfully and cannot see any
> reason why ledger would be different. Added to my todo list... :-)
Thanks...
>> Though this should work as far as I understand, it does not yet...
Dan very kindly spotted the following in my example:
> #+src_name ledger-journal
^
It looks like a random underscore crept in there.
Thanks...
True that it's a bit confusing to write src sometimes with underscores (as in
begin_src), sometimes not. But that's just a question of habit... Still newbie
as well...
Though, the following does not work yet:
--8<---------------cut here---------------start------------->8---
* Test with Org-Babel-Ledger
First evaluate this:
(org-babel-do-load-languages
'org-babel-load-languages
'((R . t)
(emacs-lisp . t)
(latex . t)
(ledger . t) ;this is the important one for this tutorial
(sh . t)))
** Journal data
#+srcname ledger-journal
#+begin_src ledger
2008/01/03 * (SCORPIOS ) SEB VAUBAM
Assets:Bank:Checking:799997400530 550.00 EUR
Assets:Bank:Transferred
2008/01/01 * ( ) UNKNOWN-PAYEE
Assets:Bank:Checking:799997400530 21.91 EUR
Expenses:Unknown
#+end_src
** Balance
Give me an overview...
#+srcname: ledger-balance
#+begin_src ledger :cmdline bal :noweb yes :session
<<ledger-journal>>
#+end_src
--8<---------------cut here---------------end--------------->8---
failing with message
"Error: Failed to locate any transactions; did you specify a valid file with -f?"
in buffer "*Shell Command ...".
Thanks for the help you already provided to me!
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-02 12:43 ` Sébastien Vauban
@ 2010-09-02 14:56 ` Eric Schulte
2010-09-03 20:53 ` Sébastien Vauban
2010-09-03 8:33 ` Eric S Fraga
1 sibling, 1 reply; 23+ messages in thread
From: Eric Schulte @ 2010-09-02 14:56 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Hi Seb,
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
[...]
>
> Though, the following does not work yet:
>
> * Test with Org-Babel-Ledger
>
> First evaluate this:
>
> (org-babel-do-load-languages
> 'org-babel-load-languages
> '((R . t)
> (emacs-lisp . t)
> (latex . t)
> (ledger . t) ;this is the important one for this tutorial
> (sh . t)))
>
> ** Journal data
>
> #+srcname ledger-journal
^
the problem is here.
#+srcname ledger-journal
should be
#+srcname: ledger-journal
I find it easiest to use yasnippets to handle the creation of all of my
code blocks to avoid these often tricky to debug minor syntax errors.
See [1] for a collection of org-mode related snippets, most importantly
the "block" and "sb" snippets.
Cheers -- Eric
Footnotes:
[1] http://github.com/eschulte/yasnippet-org-mode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-02 12:43 ` Sébastien Vauban
2010-09-02 14:56 ` Eric Schulte
@ 2010-09-03 8:33 ` Eric S Fraga
1 sibling, 0 replies; 23+ messages in thread
From: Eric S Fraga @ 2010-09-03 8:33 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2542 bytes --]
On Thu, 02 Sep 2010 14:43:07 +0200, Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:
>
> Hi Eric(s) and Dan,
>
> Eric S Fraga wrote:
> > On Wed, 01 Sep 2010 13:25:35 +0200, Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:
> >>>>> I have just placed on Worg [1] a short tutorial/example for using
> >>>>> ledger with babel. Please have a look and comment etc!
> >>>
> >>> [1] http://orgmode.org/worg/org-contrib/babel/languages.php#langs
> >>
> >> Being interested a lot in Ledger integration with Org-Babel as well, I have a
> >> quick remark: instead of including (with explicit full path) the journal
> >> entries in every code block, can't we use the more natural (at least, to me)
> >> tangling provided by the Noweb syntax?
> > Yes, I would have thought that this would work. It doesn't fit in naturally
> > with how I would like to do things as I have many different blocks of ledger
> > entries spread around the file...
>
> I don't understand your argument: why wouldn't you use <<journal-home>> blocks
> and <<journal-work>> blocks for example, or even much more? What am I missing?
You are not missing anything at all! I didn't say it couldn't be
done; I just said that it didn't fit in with *my* workflow.
I have many (tens) of little to medium sized ledger snippets
throughout my personal finances org file. As well as collections of
entries (for regular payments, say), the set of snippets includes
one-off expenses (e.g. bought a specific piece of furniture for the
house) that I want to record and annotate. Labelling all of these
snippets and then putting in the <<...>> entry in the full list gives
two extra steps. Instead, I create as many snippets as I want without
worrying about it and I simply have to /tangle/ before evaluating any of
the financial summary ledger snippets.
This minimises, for me, the number of things I need to remember to
keep track of my finances.
The other extreme is to simply put *all* ledger entries in one source
block but then you might as well use a ledger file directly...
Your suggestion fits bang in the middle and:
> What cannot be done with the noweb syntax in your Org file? I find it much
> better if we can avoid specifying explicit paths, in order to guarantee use
> and execution of our Org files by other users, on other (even Windows)
> machines, among others.
I agree completely with this. The tutorial probably did not reflect
what is likely to be the most common and more robust usage. Sorry!
[-- Attachment #2: Type: text/plain, Size: 75 bytes --]
--
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-02 14:56 ` Eric Schulte
@ 2010-09-03 20:53 ` Sébastien Vauban
2010-09-03 21:35 ` Eric Schulte
0 siblings, 1 reply; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-03 20:53 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric(s),
A few questions/comments, with the following example:
--8<---------------cut here---------------start------------->8---
#+begin_src org
** Journal data
#+srcname: ledger-journal
#+begin_src ledger
2008/01/03 * (SCORPIOS ) SEB VAUBAN
Assets:Bank:Checking:799997400530 550.00 EUR
Assets:Bank:Transferred
2008/01/01 * ( ) UNKNOWN-PAYEE
Assets:Bank:Checking:799997400530 21.91 EUR
Expenses:Unknown
#+end_src
** Registry
Give me the details...
#+srcname: ledger-registry
#+begin_src ledger :cmdline reg unknown :noweb yes :session
<<ledger-journal>>
#+end_src
#+results: ledger-registry
: 08-Jan-01 UNKNOWN-PAYEE Expenses:Unknown -21.91 EUR -21.91 EUR
#+end_src
--8<---------------cut here---------------end--------------->8---
1. I find it weird to have all the parameters of =:cmdline= not enclosed
between quotes. What should be the best option, here? That was a subject,
long ago, on Org-Babel: to quote or not to quote...
2. When the evaluation produces no output, but had well produced output
before, shouldn't Babel have to delete the previously written results in
the Org buffer?
If you don't understand what I mean, take the above example, replace
=:cmdline reg unknown :noweb yes :session=
by
=:cmdline "reg unknown" :noweb yes :session=
and see that the current results line is not removed.
Would the result exist, but be different, it would have been updated.
In this case, with a result before, but none on the second execution, first
result is conserved in Org. Do you follow me, and agree on this?
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-03 20:53 ` Sébastien Vauban
@ 2010-09-03 21:35 ` Eric Schulte
2010-09-05 20:49 ` Sébastien Vauban
0 siblings, 1 reply; 23+ messages in thread
From: Eric Schulte @ 2010-09-03 21:35 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric(s),
>
Hi Seb,
[...]
>
> 1. I find it weird to have all the parameters of =:cmdline= not enclosed
> between quotes. What should be the best option, here? That was a subject,
> long ago, on Org-Babel: to quote or not to quote...
>
I don't know that this was ever explicitly discussed, I believe that the
no-quoting behavior may have simply fallen out of the initial
implementation. I'd certainly like to hear other people's opinions on
this, but I've personally enjoyed not having to place quotes in every
instance.
>
> 2. When the evaluation produces no output, but had well produced output
> before, shouldn't Babel have to delete the previously written results in
> the Org buffer?
>
This is a good point. Currently Babel just quits if it receives a nil
result, but I think you're right that we should replace existing results
when a nil result has been returned. I'll add this as PROPOSED to the
babel task list.
Cheers -- Eric
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-03 21:35 ` Eric Schulte
@ 2010-09-05 20:49 ` Sébastien Vauban
2010-09-07 23:03 ` Eric Schulte
0 siblings, 1 reply; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-05 20:49 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>
>> Hi Eric(s),
>>
>
> Hi Seb,
>
> [...]
>>
>> 1. I find it weird to have all the parameters of =:cmdline= not enclosed
>> between quotes. What should be the best option, here? That was a subject,
>> long ago, on Org-Babel: to quote or not to quote...
>>
>
> I don't know that this was ever explicitly discussed, I believe that the
> no-quoting behavior may have simply fallen out of the initial
> implementation. I'd certainly like to hear other people's opinions on
> this, but I've personally enjoyed not having to place quotes in every
> instance.
In december 2009, I wrote:
"I'm a bit confused (as you may have seen in my last posts) about when we
do have to quote strings and when we do have to avoid doing it. Would you
have a one-liner explanation about when we have to use quotes?"
See http://www.mail-archive.com/emacs-orgmode-mXXj517/zsQ@public.gmane.org/msg20265.html for
contextual information.
I remembered "you" (Dan or you) answered it somehow, but it must have been
(around that same period) in another thread. Though, I don't find pointers
anymore...
Question is more: is it clear to mix parameters names (such as =:cmdline=) and
long values which are unquoted (such as =registry unknown credit-card= and
many much more options)?
Shouldn't we properly begin and end where the given value is?
>> 2. When the evaluation produces no output, but had well produced output
>> before, shouldn't Babel have to delete the previously written results in
>> the Org buffer?
>
> This is a good point. Currently Babel just quits if it receives a nil
> result, but I think you're right that we should replace existing results
> when a nil result has been returned. I'll add this as PROPOSED to the babel
> task list.
I consider this kind of mandatory, for the sake of coherency, and to really
make use of Org-babel every time I want to run some shell commands (and change
them, eventually getting no results then).
Thanks a lot for everything you did and do for us.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-05 20:49 ` Sébastien Vauban
@ 2010-09-07 23:03 ` Eric Schulte
2010-09-08 8:21 ` Sébastien Vauban
0 siblings, 1 reply; 23+ messages in thread
From: Eric Schulte @ 2010-09-07 23:03 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Hi Seb,
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>
>>> Hi Eric(s),
>>>
>>
>> Hi Seb,
>>
>> [...]
>>>
>>> 1. I find it weird to have all the parameters of =:cmdline= not enclosed
>>> between quotes. What should be the best option, here? That was a subject,
>>> long ago, on Org-Babel: to quote or not to quote...
>>>
>>
>> I don't know that this was ever explicitly discussed, I believe that the
>> no-quoting behavior may have simply fallen out of the initial
>> implementation. I'd certainly like to hear other people's opinions on
>> this, but I've personally enjoyed not having to place quotes in every
>> instance.
>
> In december 2009, I wrote:
>
> "I'm a bit confused (as you may have seen in my last posts) about when we
> do have to quote strings and when we do have to avoid doing it. Would you
> have a one-liner explanation about when we have to use quotes?"
>
> See http://www.mail-archive.com/emacs-orgmode@gnu.org/msg20265.html for
> contextual information.
>
> I remembered "you" (Dan or you) answered it somehow, but it must have been
> (around that same period) in another thread. Though, I don't find pointers
> anymore...
>
> Question is more: is it clear to mix parameters names (such as =:cmdline=) and
> long values which are unquoted (such as =registry unknown credit-card= and
> many much more options)?
>
> Shouldn't we properly begin and end where the given value is?
>
Through extensive person use I've not run into any instances where the
lack of quotes has actually caused a problem, or where there has been a
valid combination of header arguments which could not be successfully
parsed. Without such an example I don't find it motivating to require
quotes.
>
>
>>> 2. When the evaluation produces no output, but had well produced output
>>> before, shouldn't Babel have to delete the previously written results in
>>> the Org buffer?
>>
>> This is a good point. Currently Babel just quits if it receives a nil
>> result, but I think you're right that we should replace existing results
>> when a nil result has been returned. I'll add this as PROPOSED to the babel
>> task list.
>
> I consider this kind of mandatory, for the sake of coherency, and to really
> make use of Org-babel every time I want to run some shell commands (and change
> them, eventually getting no results then).
>
I've just pushed up a change that implements this behavior.
>
> Thanks a lot for everything you did and do for us.
>
My pleasure -- Eric
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-07 23:03 ` Eric Schulte
@ 2010-09-08 8:21 ` Sébastien Vauban
2010-09-08 17:53 ` Eric Schulte
0 siblings, 1 reply; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-08 8:21 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> "Eric Schulte" wrote:
>>> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>>>>
>>>> 1. I find it weird to have all the parameters of =:cmdline= not enclosed
>>>> between quotes. What should be the best option, here? That was a
>>>> subject, long ago, on Org-Babel: to quote or not to quote...
>>>
>>> I don't know that this was ever explicitly discussed, I believe that the
>>> no-quoting behavior may have simply fallen out of the initial
>>> implementation. I'd certainly like to hear other people's opinions on
>>> this, but I've personally enjoyed not having to place quotes in every
>>> instance.
>>
>> In december 2009, I wrote:
>>
>> "I'm a bit confused (as you may have seen in my last posts) about when we
>> do have to quote strings and when we do have to avoid doing it. Would you
>> have a one-liner explanation about when we have to use quotes?"
>>
>> See http://www.mail-archive.com/emacs-orgmode-mXXj517/zsQ@public.gmane.org/msg20265.html for
>> contextual information.
>>
>> I remembered "you" (Dan or you) answered it somehow, but it must have been
>> (around that same period) in another thread. Though, I don't find pointers
>> anymore...
>>
>> Question is more: is it clear to mix parameters names (such as =:cmdline=) and
>> long values which are unquoted (such as =registry unknown credit-card= and
>> many much more options)?
>>
>> Shouldn't we properly begin and end where the given value is?
>
> Through extensive person use I've not run into any instances where the lack
> of quotes has actually caused a problem, or where there has been a valid
> combination of header arguments which could not be successfully parsed.
> Without such an example I don't find it motivating to require quotes.
I have no objection against this, as I have no definite view on what's better.
Adding quotes would mean begin able to escape them in case the options need
quotes, etc. etc. So, maybe it is better the way it currently is.
The fact simply is sometimes we must add quotes, sometimes not, and that's not
always intuitive (to me). Not only considering Org-Babel, but Org as a whole.
See this example of `columnview':
--8<---------------cut here---------------start------------->8---
#+BEGIN: columnview :hlines 1 :id "label"
#+END:
--8<---------------cut here---------------end--------------->8---
or of `org-collector':
--8<---------------cut here---------------start------------->8---
#+BEGIN: propview :id "december" :conds ((string= spendtype "food")) :cols (ITEM amount)
#+END:
--8<---------------cut here---------------end--------------->8---
>>>> 2. When the evaluation produces no output, but had well produced output
>>>> before, shouldn't Babel have to delete the previously written results in
>>>> the Org buffer?
>>>
>>> This is a good point. Currently Babel just quits if it receives a nil
>>> result, but I think you're right that we should replace existing results
>>> when a nil result has been returned. I'll add this as PROPOSED to the babel
>>> task list.
>>
>> I consider this kind of mandatory, for the sake of coherency, and to really
>> make use of Org-babel every time I want to run some shell commands (and change
>> them, eventually getting no results then).
>>
>
> I've just pushed up a change that implements this behavior.
I've just git pulled, and tested your change.
From my point of view, it does not work yet. Take this example:
--8<---------------cut here---------------start------------->8---
* Journal data
#+srcname: ledger-journal
#+begin_src ledger
2008/01/03 * (SCORPIOS ) SEB VAUBAN
Assets:Bank:Checking:799997400530 550.00 EUR
Assets:Bank:Transferred
2008/01/01 * ( ) UNKNOWN-PAYEE
Assets:Bank:Checking:799997400530 21.91 EUR
Expenses:Unknown
#+end_src
* Registry
Give me the details...
#+srcname: ledger-registry
#+begin_src ledger :cmdline reg unknown :noweb yes :session
<<ledger-journal>>
#+end_src
#+results: ledger-registry
: -21.91 EUR Expenses:Unknown
--8<---------------cut here---------------end--------------->8---
With `:cmdline reg unknown', it produced the line with -21.91 EUR. Correct.
Now, if I write `:cmdline "reg" unknown', I expect no output from Ledger, and
thus the results block to be removed. That's not the case.
Other peculiarity, if I write `:cmdline reeg unknown', I get an exception:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (args-out-of-range "" -1 0)
substring("" -1)
(string-equal (substring result -1) "\n")
(or (string-equal (substring result -1) "\n") (string-equal (substring result -1) "\r"))
(not (or (string-equal ... "\n") (string-equal ... "\r")))
(and (stringp result) (not (or ... ...)))
(if (and (stringp result) (not ...)) (progn (setq result ...)))
(when (and (stringp result) (not ...)) (setq result (concat result "\n")))
(if (and result-params (member "silent" result-params)) (progn (message ...) result) (when (and ... ...) (setq result ...)) (save-excursion (let ... ... ... ... ... ...)) (if (= ... 0) (if ... ... ...) (message "finished")))
org-babel-insert-result("" ("output" "replace") ("ledger" "2008/01/03 * (SCORPIOS ) SEB VAUBAN\n Assets:Bank:Checking:799997400530 550.00 EUR\n Assets:Bank:Transferred\n\n2008/01/01 * ( ) UNKNOWN-PAYEE\n Assets:Bank:Checking:799997400530 21.91 EUR\n Expenses:Unknown\n" ((:cache . "no") (:cmdline . "reeg unknown") (:comments . "") (:exports . "code") (:hlines . "no") (:noweb . "yes") (:results . "output replace") (:session) (:shebang . "") (:tangle . "no")) "" "ledger-registry" 0) nil 0 "ledger")
(if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion (goto-char ...) (end-of-line 1) (forward-char 1) (setq result ...) (message ...) result) (message "executing %s code block%s..." (capitalize lang) (if ... ... "")) (setq result (funcall cmd body params)) (if (eq result-type ...) (setq result ...)) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) result)
(progn (fset (quote call-process-region) (function* ...)) (unless (fboundp cmd) (error "No org-babel-execute function for %s!" lang)) (if (and ... new-hash ...) (save-excursion ... ... ... ... ... result) (message "executing %s code block%s..." ... ...) (setq result ...) (if ... ...) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks ...) result))
(unwind-protect (progn (fset ... ...) (unless ... ...) (if ... ... ... ... ... ... ... result)) (if --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
(let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect (progn ... ... ...) (if --cl-letf-bound-- ... ...)))
(letf ((... ...)) (unless (fboundp cmd) (error "No org-babel-execute function for %s!" lang)) (if (and ... new-hash ...) (save-excursion ... ... ... ... ... result) (message "executing %s code block%s..." ... ...) (setq result ...) (if ... ...) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks ...) result))
(letf* ((... ...)) (unless (fboundp cmd) (error "No org-babel-execute function for %s!" lang)) (if (and ... new-hash ...) (save-excursion ... ... ... ... ... result) (message "executing %s code block%s..." ... ...) (setq result ...) (if ... ...) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks ...) result))
(flet ((call-process-region ... ...)) (unless (fboundp cmd) (error "No org-babel-execute function for %s!" lang)) (if (and ... new-hash ...) (save-excursion ... ... ... ... ... result) (message "executing %s code block%s..." ... ...) (setq result ...) (if ... ...) (org-babel-insert-result result result-params info new-hash indent lang) (run-hooks ...) result))
(unwind-protect (flet (...) (unless ... ...) (if ... ... ... ... ... ... ... result)) (setq call-process-region (quote org-babel-call-process-region-original)))
(let* ((lang ...) (params ...) (new-hash ...) (old-hash ...) (body ...) (result-params ...) (result-type ...) (cmd ...) (dir ...) (default-directory ...) (org-babel-call-process-region-original ...) (indent ...) result) (unwind-protect (flet ... ... ...) (setq call-process-region ...)))
(progn (let* (... ... ... ... ... ... ... ... ... ... ... ... result) (unwind-protect ... ...)))
(if (org-babel-confirm-evaluate info) (progn (let* ... ...)))
(when (org-babel-confirm-evaluate info) (let* (... ... ... ... ... ... ... ... ... ... ... ... result) (unwind-protect ... ...)))
(let ((info ...)) (when (org-babel-confirm-evaluate info) (let* ... ...)))
org-babel-execute-src-block(nil ("ledger" "2008/01/03 * (SCORPIOS ) SEB VAUBAN\n Assets:Bank:Checking:799997400530 550.00 EUR\n Assets:Bank:Transferred\n\n2008/01/01 * ( ) UNKNOWN-PAYEE\n Assets:Bank:Checking:799997400530 21.91 EUR\n Expenses:Unknown\n" ((:cache . "no") (:cmdline . "reeg unknown") (:comments . "") (:exports . "code") (:hlines . "no") (:noweb . "yes") (:results . "output replace") (:session) (:shebang . "") (:tangle . "no")) "" "ledger-registry" 0))
(progn (org-babel-execute-src-block current-prefix-arg info) t)
(if info (progn (org-babel-execute-src-block current-prefix-arg info) t) nil)
(let ((info ...)) (if info (progn ... t) nil))
org-babel-execute-src-block-maybe()
(or (org-babel-execute-src-block-maybe) (org-babel-lob-execute-maybe))
org-babel-execute-maybe()
call-interactively(org-babel-execute-maybe nil nil)
--8<---------------cut here---------------end--------------->8---
>> Thanks a lot for everything you did and do for us.
>
> My pleasure -- Eric
Still applicable... ;-)
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-08 8:21 ` Sébastien Vauban
@ 2010-09-08 17:53 ` Eric Schulte
2010-09-08 21:40 ` Sébastien Vauban
0 siblings, 1 reply; 23+ messages in thread
From: Eric Schulte @ 2010-09-08 17:53 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Hi Seb,
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>> "Eric Schulte" wrote:
>>>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
[...]
>>>>> 2. When the evaluation produces no output, but had well produced output
>>>>> before, shouldn't Babel have to delete the previously written results in
>>>>> the Org buffer?
>>>>
>>>> This is a good point. Currently Babel just quits if it receives a nil
>>>> result, but I think you're right that we should replace existing results
>>>> when a nil result has been returned. I'll add this as PROPOSED to the babel
>>>> task list.
>>>
>>> I consider this kind of mandatory, for the sake of coherency, and to really
>>> make use of Org-babel every time I want to run some shell commands (and change
>>> them, eventually getting no results then).
>>>
>>
>> I've just pushed up a change that implements this behavior.
>
> I've just git pulled, and tested your change.
>
> From my point of view, it does not work yet. Take this example:
>
[...]
>
> With `:cmdline reg unknown', it produced the line with -21.91 EUR. Correct.
>
> Now, if I write `:cmdline "reg" unknown', I expect no output from Ledger, and
> thus the results block to be removed. That's not the case.
>
If ledger throws an exception then the result probably will not be
replaced, however if ledger does return an empty result, then the
existing result will be removed. If you execute the following code
block
#+begin_src emacs-lisp
"test"
#+end_src
and then change the body to "" is the previous result removed?
>
> Other peculiarity, if I write `:cmdline reeg unknown', I get an
> exception:
>
Ah, thanks for pointing this out, it seems I introduced an error with my
previous change. I've just pushed up a fix for this issue.
Thanks -- Eric
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-08 17:53 ` Eric Schulte
@ 2010-09-08 21:40 ` Sébastien Vauban
2010-09-08 22:46 ` Eric Schulte
2010-09-09 12:14 ` Sébastien Vauban
0 siblings, 2 replies; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-08 21:40 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> "Eric Schulte" wrote:
>>> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>>>> "Eric Schulte" wrote:
>>>>> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>>>>>>
>>>>>> 2. When the evaluation produces no output, but had well produced output
>>>>>> before, shouldn't Babel have to delete the previously written
>>>>>> results in the Org buffer?
>>>>>
>>>>> This is a good point. Currently Babel just quits if it receives a nil
>>>>> result, but I think you're right that we should replace existing results
>>>>> when a nil result has been returned. I'll add this as PROPOSED to the
>>>>> babel task list.
>>>>
>>>> I consider this kind of mandatory, for the sake of coherency, and to
>>>> really make use of Org-babel every time I want to run some shell commands
>>>> (and change them, eventually getting no results then).
>>>
>>> I've just pushed up a change that implements this behavior.
>>
>> From my point of view, it does not work yet. Take this example:
>>
>> With `:cmdline reg unknown', it produced the line with -21.91 EUR. Correct.
>>
>> Now, if I write `:cmdline "reg" unknown', I expect no output from Ledger,
>> and thus the results block to be removed. That's not the case.
>
> If ledger throws an exception then the result probably will not be replaced,
> however if ledger does return an empty result, then the existing result will
> be removed.
What do you mean by ledger throwing an exception? Having a return code
different from 0?
For me, the result block should be removed in both cases:
- "exception" of ledger
- empty result of ledger
Or, if not, then (even better): instead of simply removing the result block,
replace it with a sort of error message, saying that ledger's execution failed
and returned XXX as exit code.
Whatever the solution, we have to clearly be aware that the previous results
are now wrong, and that the new result is a failure or empty.
>> Other peculiarity, if I write `:cmdline reeg unknown', I get an
>> exception:
>
> Ah, thanks for pointing this out, it seems I introduced an error with my
> previous change. I've just pushed up a fix for this issue.
Thanks. But right now, I don't get anything back from the following (same as
for thread about isodoc letters):
--8<---------------cut here---------------start------------->8---
#+srcname: ledger-journal
#+begin_src ledger
2008/01/03 * (SCORPIOS ) SEB VAUBAN
Assets:Bank:Checking:799997400530 550.00 EUR
Assets:Bank:Transferred
2008/01/01 * ( ) UNKNOWN-PAYEE
Assets:Bank:Checking:799997400530 21.91 EUR
Expenses:Unknown
#+end_src
#+srcname: ledger-registry
#+begin_src ledger :cmdline reg unknown :noweb yes :session
<<ledger-journal>>
#+end_src
--8<---------------cut here---------------end--------------->8---
In the *Messages* buffer, I get:
--8<---------------cut here---------------start------------->8---
Checking for library `filladapt'... Found
Fontifying scorpios.org... (regexps.............................................)
Checking for library `filladapt'... Found
Fontifying scorpios.org... (regexps..............................................)
Checking for library `filladapt'... Found
Fontifying scorpios.org... (regexps...............................................)
Checking for library `filladapt'... Found
Checking for library `filladapt'... Found
Org-mode restarted
Local setup has been refreshed
--8<---------------cut here---------------end--------------->8---
... but no result block is added in my Org buffer.
I'll carefully test all of this, as soon as I can re-execute Babel under
normal conditions.
Thanks for your help.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-08 21:40 ` Sébastien Vauban
@ 2010-09-08 22:46 ` Eric Schulte
2010-09-09 12:14 ` Sébastien Vauban
1 sibling, 0 replies; 23+ messages in thread
From: Eric Schulte @ 2010-09-08 22:46 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 3094 bytes --]
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>> "Eric Schulte" wrote:
>>>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>>>> "Eric Schulte" wrote:
>>>>>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>>>>>>
>>>>>>> 2. When the evaluation produces no output, but had well produced output
>>>>>>> before, shouldn't Babel have to delete the previously written
>>>>>>> results in the Org buffer?
>>>>>>
>>>>>> This is a good point. Currently Babel just quits if it receives a nil
>>>>>> result, but I think you're right that we should replace existing results
>>>>>> when a nil result has been returned. I'll add this as PROPOSED to the
>>>>>> babel task list.
>>>>>
>>>>> I consider this kind of mandatory, for the sake of coherency, and to
>>>>> really make use of Org-babel every time I want to run some shell commands
>>>>> (and change them, eventually getting no results then).
>>>>
>>>> I've just pushed up a change that implements this behavior.
>>>
>>> From my point of view, it does not work yet. Take this example:
>>>
>>> With `:cmdline reg unknown', it produced the line with -21.91 EUR. Correct.
>>>
>>> Now, if I write `:cmdline "reg" unknown', I expect no output from Ledger,
>>> and thus the results block to be removed. That's not the case.
>>
>> If ledger throws an exception then the result probably will not be replaced,
>> however if ledger does return an empty result, then the existing result will
>> be removed.
>
> What do you mean by ledger throwing an exception? Having a return code
> different from 0?
>
Yes, that's exactly what I mean.
>
> For me, the result block should be removed in both cases:
> - "exception" of ledger
> - empty result of ledger
>
> Or, if not, then (even better): instead of simply removing the result block,
> replace it with a sort of error message, saying that ledger's execution failed
> and returned XXX as exit code.
>
This is what we used to do (insert the error output into the buffer as
results), however we now treat error messages and STDOUT differently,
and Babel /should/ notify you of error output and then abort the
evaluation chain.
>
> Whatever the solution, we have to clearly be aware that the previous
> results are now wrong, and that the new result is a failure or empty.
>
Agreed, this notification should be done through a pop-up buffer of the
error output (however the previous results are retained because at least
when they were generated they were not an error). Also, returning the
error results could cause problems in the case of chained code blocks.
I don't have a local ledger install, and I didn't implement the Babel
ledger support, but I've made some changes to ob-ledger so that it now
uses the general Babel external evaluation tools (which should raise
errors as I've mentioned above). Could you give this patch (attached) a
try and let me know if it improves the behavior you're seeing?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ledger-notices-errors.patch --]
[-- Type: text/x-diff, Size: 1342 bytes --]
diff --git a/lisp/ob-ledger.el b/lisp/ob-ledger.el
index edd803f..ddaa93a 100644
--- a/lisp/ob-ledger.el
+++ b/lisp/ob-ledger.el
@@ -38,6 +38,7 @@
;;; Code:
(require 'ob)
+(require 'ob-eval)
(require 'org)
(defvar org-babel-default-header-args:ledger
@@ -48,15 +49,13 @@
"Execute a block of Ledger entries with org-babel. This function is
called by `org-babel-execute-src-block'."
(message "executing Ledger source code block")
- (let ((result-params (split-string (or (cdr (assoc :results params)) "")))
- (cmdline (cdr (assoc :cmdline params)))
- (in-file (org-babel-temp-file "ledger-"))
- (out-file (org-babel-temp-file "ledger-output-"))
- )
+ (let* ((result-params (split-string (or (cdr (assoc :results params)) "")))
+ (cmdline (cdr (assoc :cmdline params)))
+ (in-file (org-babel-temp-file "ledger-"))
+ (out-file (org-babel-temp-file "ledger-output-"))
+ (cmd (concat "ledger -f " in-file " " cmdline " > " out-file)))
(with-temp-file in-file (insert body))
- (message (concat "ledger -f " in-file " " cmdline))
- (with-output-to-string
- (shell-command (concat "ledger -f " in-file " " cmdline " > " out-file)))
+ (message cmd) (org-babel-eval cmd "")
(with-temp-buffer (insert-file-contents out-file) (buffer-string))))
(defun org-babel-prep-session:ledger (session params)
[-- Attachment #3: Type: text/plain, Size: 1717 bytes --]
>
>
>>> Other peculiarity, if I write `:cmdline reeg unknown', I get an
>>> exception:
>>
>> Ah, thanks for pointing this out, it seems I introduced an error with my
>> previous change. I've just pushed up a fix for this issue.
>
> Thanks. But right now, I don't get anything back from the following (same as
> for thread about isodoc letters):
>
After updating Org-mode are you running make clean && make (and maybe
make install) to clear out the old compiled elisp files?
Best -- Eric
>
> #+srcname: ledger-journal
> #+begin_src ledger
> 2008/01/03 * (SCORPIOS ) SEB VAUBAN
> Assets:Bank:Checking:799997400530 550.00 EUR
> Assets:Bank:Transferred
>
> 2008/01/01 * ( ) UNKNOWN-PAYEE
> Assets:Bank:Checking:799997400530 21.91 EUR
> Expenses:Unknown
> #+end_src
>
> #+srcname: ledger-registry
> #+begin_src ledger :cmdline reg unknown :noweb yes :session
> <<ledger-journal>>
> #+end_src
>
> In the *Messages* buffer, I get:
>
> Checking for library `filladapt'... Found
> Fontifying scorpios.org... (regexps.............................................)
> Checking for library `filladapt'... Found
> Fontifying scorpios.org... (regexps..............................................)
> Checking for library `filladapt'... Found
> Fontifying scorpios.org... (regexps...............................................)
> Checking for library `filladapt'... Found
> Checking for library `filladapt'... Found
> Org-mode restarted
> Local setup has been refreshed
>
> ... but no result block is added in my Org buffer.
>
> I'll carefully test all of this, as soon as I can re-execute Babel under
> normal conditions.
>
> Thanks for your help.
>
> Best regards,
> Seb
[-- Attachment #4: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-08 21:40 ` Sébastien Vauban
2010-09-08 22:46 ` Eric Schulte
@ 2010-09-09 12:14 ` Sébastien Vauban
2010-09-09 15:29 ` Eric Schulte
1 sibling, 1 reply; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-09 12:14 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
Sébastien Vauban wrote:
> [...] But right now, I don't get anything back from the following (same as
> for thread about isodoc letters):
>
> #+srcname: ledger-journal
> #+begin_src ledger
> 2008/01/03 * (SCORPIOS ) SEB VAUBAN
> Assets:Bank:Checking:799997400530 550.00 EUR
> Assets:Bank:Transferred
>
> 2008/01/01 * ( ) UNKNOWN-PAYEE
> Assets:Bank:Checking:799997400530 21.91 EUR
> Expenses:Unknown
> #+end_src
>
> #+srcname: ledger-registry
> #+begin_src ledger :cmdline reg unknown :noweb yes :session
> <<ledger-journal>>
> #+end_src
>
> In the *Messages* buffer, I get:
>
> Checking for library `filladapt'... Found
> Fontifying scorpios.org... (regexps.............................................)
> Checking for library `filladapt'... Found
> Fontifying scorpios.org... (regexps..............................................)
> Checking for library `filladapt'... Found
> Fontifying scorpios.org... (regexps...............................................)
> Checking for library `filladapt'... Found
> Checking for library `filladapt'... Found
> Org-mode restarted
> Local setup has been refreshed
>
> ... but no result block is added in my Org buffer.
>
> I'll carefully test all of this, as soon as I can re-execute Babel under
> normal conditions.
Stupid from me... I have absolutely no idea why, but, instead of pressing C-c
C-v C-e, I reused the old binging C-c C-c, hence not much happened -- as it is
disabled in my `.emacs' file:
(setq org-babel-no-eval-on-ctrl-c-ctrl-c t)
Maybe it'd be good to echo that "no eval" occurs anymore in such a condition?
Anyway, not always productive to work late...
Side question, as I searched everywhere for the cause of my problem: is it
totally equivalent to use `org-babel-do-load-languages' than to load
individual languages?
I currently have this in my config file:
--8<---------------cut here---------------start------------->8---
;; customize the `org-babel-load-languages' variable to enable support
;; for languages which can be evaluated in Org mode buffers
(when (fboundp 'org-babel-do-load-languages)
(org-babel-do-load-languages
'org-babel-load-languages
'((R . t)
(ditaa . t)
(dot . t)
(emacs-lisp . t)
(gnuplot . t)
(haskell . nil)
(latex . t)
(ledger . t)
(ocaml . nil)
(octave . t)
(org . t) ;; VIP!
(python . t)
(ruby . t)
(screen . nil)
(sh . t)
(sql . nil)
(sqlite . t))))
;; activate a subset of languages
(try-require 'ob-sh)
(try-require 'ob-ditaa)
;; TODO Install this for Ditaa: sudo aptitude install openjdk-6-jre
(try-require 'ob-dot)
(try-require 'ob-emacs-lisp)
(try-require 'ob-gnuplot)
;; requires gnuplot-mode
(try-require 'ob-latex)
;; get `BEGIN_SRC org'/`END_SRC' blocks interpreted as Org markup
(try-require 'ob-org)
(try-require 'ob-perl)
(try-require 'ob-python)
;; requires python, and python-mode
(try-require 'ob-R)
;; requires R and ess-mode
(try-require 'ob-ruby)
;; requires ruby, irb, ruby-mode, and inf-ruby
(try-require 'ob-sql)
;; (require 'ob-identifier) ; ????????
;; support for interactive terminals. Mostly shell scripts. Heavily
;; inspired by `eev'
(try-require 'ob-screen)
;; Eric Schulte believes screen has more of a focus on sustained
;; interaction with an interactive terminal, although to be honest he
;; haven't really used it and
--8<---------------cut here---------------end--------------->8---
I'm not sure to understand *all* the implications of choosing one over the
other, even after having read:
(info "(org)Languages")
and `ob-org.el' for example.
Can you give me a hint, please?
Best regards,
Seb
PS- `try-require' is my customized `require', which does not stop if file is
not found...
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Re: [babel] ledger tutorial on Worg
2010-09-09 12:14 ` Sébastien Vauban
@ 2010-09-09 15:29 ` Eric Schulte
2010-09-09 19:59 ` Sébastien Vauban
0 siblings, 1 reply; 23+ messages in thread
From: Eric Schulte @ 2010-09-09 15:29 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> Sébastien Vauban wrote:
>> [...] But right now, I don't get anything back from the following (same as
>> for thread about isodoc letters):
>>
>> #+srcname: ledger-journal
>> #+begin_src ledger
>> 2008/01/03 * (SCORPIOS ) SEB VAUBAN
>> Assets:Bank:Checking:799997400530 550.00 EUR
>> Assets:Bank:Transferred
>>
>> 2008/01/01 * ( ) UNKNOWN-PAYEE
>> Assets:Bank:Checking:799997400530 21.91 EUR
>> Expenses:Unknown
>> #+end_src
>>
>> #+srcname: ledger-registry
>> #+begin_src ledger :cmdline reg unknown :noweb yes :session
>> <<ledger-journal>>
>> #+end_src
>>
>> In the *Messages* buffer, I get:
>>
>> Checking for library `filladapt'... Found
>> Fontifying scorpios.org... (regexps.............................................)
>> Checking for library `filladapt'... Found
>> Fontifying scorpios.org... (regexps..............................................)
>> Checking for library `filladapt'... Found
>> Fontifying scorpios.org... (regexps...............................................)
>> Checking for library `filladapt'... Found
>> Checking for library `filladapt'... Found
>> Org-mode restarted
>> Local setup has been refreshed
>>
>> ... but no result block is added in my Org buffer.
>>
>> I'll carefully test all of this, as soon as I can re-execute Babel under
>> normal conditions.
>
> Stupid from me... I have absolutely no idea why, but, instead of pressing C-c
> C-v C-e, I reused the old binging C-c C-c, hence not much happened -- as it is
> disabled in my `.emacs' file:
>
> (setq org-babel-no-eval-on-ctrl-c-ctrl-c t)
>
as a side note, for experimenting with tangling like in the above, I
find the `org-babel-expand-src-block' command bound to C-c C-v v
(mnemonic "view") to be very useful as it shows the expanded version of
the current code block.
>
> Maybe it'd be good to echo that "no eval" occurs anymore in such a
> condition?
>
hmm, but then it would inhibit C-c C-c from performing the next action
in the `org-ctrl-c-ctrl-c-hook'.
>
> Anyway, not always productive to work late...
>
> Side question, as I searched everywhere for the cause of my problem: is it
> totally equivalent to use `org-babel-do-load-languages' than to load
> individual languages?
>
Yes, they are fully equivalent.
>
> I currently have this in my config file:
>
> ;; customize the `org-babel-load-languages' variable to enable support
> ;; for languages which can be evaluated in Org mode buffers
> (when (fboundp 'org-babel-do-load-languages)
> (org-babel-do-load-languages
> 'org-babel-load-languages
> '((R . t)
> (ditaa . t)
> (dot . t)
> (emacs-lisp . t)
> (gnuplot . t)
> (haskell . nil)
> (latex . t)
> (ledger . t)
> (ocaml . nil)
> (octave . t)
> (org . t) ;; VIP!
> (python . t)
> (ruby . t)
> (screen . nil)
> (sh . t)
> (sql . nil)
> (sqlite . t))))
>
All of the following require statements should be deleted as the
language support will already be loaded by the call to
`org-babel-do-load-languages' above.
>
> ;; activate a subset of languages
> (try-require 'ob-sh)
>
> (try-require 'ob-ditaa)
> ;; TODO Install this for Ditaa: sudo aptitude install openjdk-6-jre
>
> (try-require 'ob-dot)
>
> (try-require 'ob-emacs-lisp)
>
> (try-require 'ob-gnuplot)
> ;; requires gnuplot-mode
>
> (try-require 'ob-latex)
>
> ;; get `BEGIN_SRC org'/`END_SRC' blocks interpreted as Org markup
> (try-require 'ob-org)
>
> (try-require 'ob-perl)
>
> (try-require 'ob-python)
> ;; requires python, and python-mode
>
> (try-require 'ob-R)
> ;; requires R and ess-mode
>
> (try-require 'ob-ruby)
> ;; requires ruby, irb, ruby-mode, and inf-ruby
>
> (try-require 'ob-sql)
>
> ;; (require 'ob-identifier) ; ????????
>
> ;; support for interactive terminals. Mostly shell scripts. Heavily
> ;; inspired by `eev'
> (try-require 'ob-screen)
> ;; Eric Schulte believes screen has more of a focus on sustained
> ;; interaction with an interactive terminal, although to be honest he
> ;; haven't really used it and
>
> I'm not sure to understand *all* the implications of choosing one over the
> other, even after having read:
>
> (info "(org)Languages")
>
> and `ob-org.el' for example.
>
> Can you give me a hint, please?
>
I'd recommend just using `org-babel-load-languages' and removing the
explicit try-require lines.
Cheers -- Eric
>
> Best regards,
> Seb
>
> PS- `try-require' is my customized `require', which does not stop if file is
> not found...
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-09 15:29 ` Eric Schulte
@ 2010-09-09 19:59 ` Sébastien Vauban
2010-09-09 21:15 ` Sébastien Vauban
0 siblings, 1 reply; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-09 19:59 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> Hi Eric,
>> Sébastien Vauban wrote:
>>> ... but no result block is added in my Org buffer.
>>>
>>> I'll carefully test all of this, as soon as I can re-execute Babel under
>>> normal conditions.
>>
>> Stupid from me... I have absolutely no idea why, but, instead of pressing
>> C-c C-v C-e, I reused the old binging C-c C-c, hence not much happened --
>> as it is disabled in my `.emacs' file:
>>
>> (setq org-babel-no-eval-on-ctrl-c-ctrl-c t)
>
> as a side note, for experimenting with tangling like in the above, I
> find the `org-babel-expand-src-block' command bound to C-c C-v v
> (mnemonic "view") to be very useful as it shows the expanded version of
> the current code block.
Knew about it. But... never used/thought before. Interesting command!
>> Maybe it'd be good to echo that "no eval" occurs anymore in such a
>> condition?
>
> hmm, but then it would inhibit C-c C-c from performing the next action
> in the `org-ctrl-c-ctrl-c-hook'.
I mean: if C-c C-c is disabled, but run on code, then echo "I do nothing". If
not, do the same as C-c C-v C-e...
Feasible? Interesting (for others, like me, in the future)?
>> Anyway, not always productive to work late...
>>
>> Side question, as I searched everywhere for the cause of my problem: is it
>> totally equivalent to use `org-babel-do-load-languages' than to load
>> individual languages?
>
> Yes, they are fully equivalent.
OK. Thanks for the tip.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-09 19:59 ` Sébastien Vauban
@ 2010-09-09 21:15 ` Sébastien Vauban
2010-09-09 21:42 ` Dan Davison
0 siblings, 1 reply; 23+ messages in thread
From: Sébastien Vauban @ 2010-09-09 21:15 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
Sébastien Vauban wrote:
> "Eric Schulte" wrote:
>> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw-XMD5yJDbdMRG2NFembrH+g@public.gmane.orgorg> writes:
>>> Hi Eric,
>>> Sébastien Vauban wrote:
>> as a side note, for experimenting with tangling like in the above, I
>> find the `org-babel-expand-src-block' command bound to C-c C-v v
>> (mnemonic "view") to be very useful as it shows the expanded version of
>> the current code block.
>
> Knew about it. But... never used/thought before. Interesting command!
Though...
When editing code with =C-c '=, I chose to reuse the current window.
When viewing the results, I find myself preferring to use another window, so
that I see what the code is, and to what it gets converted.
For the first case, I have to write:
(setq org-src-window-setup 'current-window)
For the second:
(setq org-src-window-setup 'reorganize-frame)
Is it, then, possible to get two vars? Or is my suggestion a bit silly?
>>> Maybe it'd be good to echo that "no eval" occurs anymore in such a
>>> condition?
>>
>> hmm, but then it would inhibit C-c C-c from performing the next action
>> in the `org-ctrl-c-ctrl-c-hook'.
>
> I mean: if C-c C-c is disabled, but run on code, then echo "I do nothing". If
> not, do the same as C-c C-v C-e...
>
> Feasible? Interesting (for others, like me, in the future)?
Echoing that request, so that you can answer both in one post...
Thanks in advance.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [babel] ledger tutorial on Worg
2010-09-09 21:15 ` Sébastien Vauban
@ 2010-09-09 21:42 ` Dan Davison
0 siblings, 0 replies; 23+ messages in thread
From: Dan Davison @ 2010-09-09 21:42 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
writes:
> Hi Eric,
>
> Sébastien Vauban wrote:
>> "Eric Schulte" wrote:
>>> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw-XMD5yJDbdMRG2NFembrH+g@public.gmane.orgorg> writes:
>>>> Hi Eric,
>>>> Sébastien Vauban wrote:
>>> as a side note, for experimenting with tangling like in the above, I
>>> find the `org-babel-expand-src-block' command bound to C-c C-v v
>>> (mnemonic "view") to be very useful as it shows the expanded version of
>>> the current code block.
>>
>> Knew about it. But... never used/thought before. Interesting command!
>
> Though...
>
> When editing code with =C-c '=, I chose to reuse the current window.
>
> When viewing the results, I find myself preferring to use another window, so
> that I see what the code is, and to what it gets converted.
>
> For the first case, I have to write:
>
> (setq org-src-window-setup 'current-window)
>
> For the second:
>
> (setq org-src-window-setup 'reorganize-frame)
>
> Is it, then, possible to get two vars? Or is my suggestion a bit silly?
Hi Seb, in the absence of having distinct variables for this, you could
make your own version, e.g.
(defun my/org-babel-expand-src-block ()
(interactive)
(let ((org-src-window-setup 'reorganize-frame))
(org-babel-expand-src-block)))
Dan
>
>
>>>> Maybe it'd be good to echo that "no eval" occurs anymore in such a
>>>> condition?
>>>
>>> hmm, but then it would inhibit C-c C-c from performing the next action
>>> in the `org-ctrl-c-ctrl-c-hook'.
>>
>> I mean: if C-c C-c is disabled, but run on code, then echo "I do nothing". If
>> not, do the same as C-c C-v C-e...
>>
>> Feasible? Interesting (for others, like me, in the future)?
>
> Echoing that request, so that you can answer both in one post...
>
> Thanks in advance.
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2010-09-09 21:42 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-26 23:06 [babel] ledger tutorial on Worg Eric S Fraga
2010-08-27 14:53 ` Carsten Dominik
2010-08-27 15:27 ` Eric Schulte
2010-08-27 19:33 ` Eric S Fraga
2010-09-01 11:25 ` Sébastien Vauban
2010-09-01 18:33 ` Eric S Fraga
2010-09-02 0:19 ` Eric Schulte
2010-09-02 12:43 ` Sébastien Vauban
2010-09-02 14:56 ` Eric Schulte
2010-09-03 20:53 ` Sébastien Vauban
2010-09-03 21:35 ` Eric Schulte
2010-09-05 20:49 ` Sébastien Vauban
2010-09-07 23:03 ` Eric Schulte
2010-09-08 8:21 ` Sébastien Vauban
2010-09-08 17:53 ` Eric Schulte
2010-09-08 21:40 ` Sébastien Vauban
2010-09-08 22:46 ` Eric Schulte
2010-09-09 12:14 ` Sébastien Vauban
2010-09-09 15:29 ` Eric Schulte
2010-09-09 19:59 ` Sébastien Vauban
2010-09-09 21:15 ` Sébastien Vauban
2010-09-09 21:42 ` Dan Davison
2010-09-03 8:33 ` Eric S Fraga
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).