emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* debugging sbe calls
@ 2010-08-05 12:42 Inquisitive Scientist
  2010-08-06  8:20 ` Sébastien Vauban
  2010-08-08 11:16 ` David Maus
  0 siblings, 2 replies; 4+ messages in thread
From: Inquisitive Scientist @ 2010-08-05 12:42 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1738 bytes --]

Dear Experts,

I *love* org-babel. In trying to switch a bunch of things to using it, I
have run into the problem that if I get the syntax slightly wrong, either
nothing happens (no output) or I just get something like "ERROR". Is there a
way to understand what is causing the error? So far, I have resorted to
creating a checklist of common mistakes which I run through whenever
something doesn't work. I think many of these look like things which could
in theory be detected and warned or complained about. Any suggestions on
debugging would be much appreciated.

Below is a list of some common mistakes.

** common mistakes

*** forgetting colon on srcname

If you do the following (note the missing colon on srcname)

#+srcname Cube(x=3)
#+begin_src python :results value :export code
return x*x*x
#+end_src

then things won't work (e.g., you may get an error about "global name
'x' is not defined" which is pretty confusing).

Instead, make sure you have the colons and do

#+srcname: Cube(x=3)
#+begin_src python :results value :export both
return x*x*x
#+end_src

which gives

#+results: Cube
: 27

*** forgetting = in chained sbe call

Make sure you include the = sign in a chained sbe call like the
following:

| 512 |
#+TBLFM: @1$1='(sbe "Cube" (x "Cube(x=2)"))

If you forget the = as in
| 19683 |
#+TBLFM: @1$1='(sbe "Cube" (x "Cube(x 1)"))

or if you forget a quote as in
| #ERROR |
#+TBLFM: @1$1='(sbe "Cube" (x "Cube(x=2)))
it won't work.

*** getting confused on sbe call

It's common to forget that the sbe syntax uses pairs *without* the
equal sign. Consequently, something like
| #ERROR |
#+TBLFM: @1$1='(sbe "Cube" (x=2))

won't work but something like

| 8 |
#+TBLFM: @1$1='(sbe "Cube" (x 2))

will do what you want.

[-- Attachment #1.2: Type: text/html, Size: 2096 bytes --]

[-- Attachment #2: 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] 4+ messages in thread

* Re: debugging sbe calls
  2010-08-05 12:42 debugging sbe calls Inquisitive Scientist
@ 2010-08-06  8:20 ` Sébastien Vauban
  2010-08-06  9:53   ` Dan Davison
  2010-08-08 11:16 ` David Maus
  1 sibling, 1 reply; 4+ messages in thread
From: Sébastien Vauban @ 2010-08-06  8:20 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Inquisitive Scientist,

Inquisitive Scientist wrote:
> I *love* org-babel.

So do I. That's even not love anymore, but passion... Even if I almost don't
use it, only when I need to write doc in a "literate programming" style. But,
thinking at using it for every little script I write, as well.


> Any suggestions on debugging would be much appreciated.
>
> Below is a list of some common mistakes.
>
> ** common mistakes
>
> *** forgetting colon on srcname

This one is easy to fix. Use yasnippet. Type `sb <TAB>' and you're done.

Definition of `sb':

--8<---------------cut here---------------start------------->8---
#name : #+begin_src...#+end_src
# --
#+srcname: ${1:name}
#+begin_src ${2:language} $3
$0
#+end_src
--8<---------------cut here---------------end--------------->8---

The only thing that still annoys me, is:

- I type the name, then TAB
- I type the language, then TAB
- I have to delete the trailing space (yes, I'm paranoid), but I can't do it
  immediately. I first have to move cursor, then can come back to the extra
  space, and remove it...

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] 4+ messages in thread

* Re: debugging sbe calls
  2010-08-06  8:20 ` Sébastien Vauban
@ 2010-08-06  9:53   ` Dan Davison
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Davison @ 2010-08-06  9:53 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 Inquisitive Scientist,
>
> Inquisitive Scientist wrote:
>> I *love* org-babel.
>
> So do I. That's even not love anymore, but passion... Even if I almost don't
> use it, only when I need to write doc in a "literate programming" style. But,
> thinking at using it for every little script I write, as well.
>
>
>> Any suggestions on debugging would be much appreciated.
>>
>> Below is a list of some common mistakes.
>>
>> ** common mistakes
>>
>> *** forgetting colon on srcname
>
> This one is easy to fix. Use yasnippet. Type `sb <TAB>' and you're done.
>
> Definition of `sb':
>
> #name : #+begin_src...#+end_src
> # --
> #+srcname: ${1:name}
> #+begin_src ${2:language} $3
> $0
> #+end_src
>
> The only thing that still annoys me, is:
>
> - I type the name, then TAB
> - I type the language, then TAB
> - I have to delete the trailing space (yes, I'm paranoid), but I can't do it
>   immediately. I first have to move cursor, then can come back to the extra
>   space, and remove it...

Hi Seb,

I'm with you. That was annoying me too. I'm using this simpler one.

#+begin_src...#+end_src
# --
#+begin_src ${2:language}
$0
#+end_src

Dan

>
> Best regards,
>   Seb

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: debugging sbe calls
  2010-08-05 12:42 debugging sbe calls Inquisitive Scientist
  2010-08-06  8:20 ` Sébastien Vauban
@ 2010-08-08 11:16 ` David Maus
  1 sibling, 0 replies; 4+ messages in thread
From: David Maus @ 2010-08-08 11:16 UTC (permalink / raw)
  To: Inquisitive Scientist; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 784 bytes --]

Inquisitive Scientist wrote:
>Dear Experts,

>I *love* org-babel. In trying to switch a bunch of things to using
>it, I have run into the problem that if I get the syntax slightly
>wrong, either nothing happens (no output) or I just get something
>like "ERROR". Is there a way to understand what is causing the error?
>So far, I have resorted to creating a checklist of common mistakes
>which I run through whenever something doesn't work. I think many of
>these look like things which could in theory be detected and warned
>or complained about.

Well, or at least such a list would make a good starting point for a
page on Worg about common mistakes and pitfalls with babel.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: 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] 4+ messages in thread

end of thread, other threads:[~2010-08-08 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 12:42 debugging sbe calls Inquisitive Scientist
2010-08-06  8:20 ` Sébastien Vauban
2010-08-06  9:53   ` Dan Davison
2010-08-08 11:16 ` David Maus

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).