emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* using org-babel-trim in org-sbe?
@ 2014-04-03 11:48 Alan Schmitt
  2014-04-18 13:17 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2014-04-03 11:48 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I noticed a call to org-sbe failed because there were some extra spaces
present in one argument. I tried to clean them up before calling the
code block, but instead I'm getting literally what I'm writing. Here is
an example:

--8<---------------cut here---------------start------------->8---
#+name: spending
#+begin_src sh :var c="bar" :results output
echo "res:$c:"
#+end_src

| Name | Test1       | Test2                        |
|------+-------------+------------------------------|
| Food | res: Food : | res: (org-babel-trim Food) : |
#+TBLFM: $2='(org-sbe spending (c (concat "\"" $1 "\"")))::$3='(org-sbe spending (c (concat "\"" (org-babel-trim $1) "\"")))
--8<---------------cut here---------------end--------------->8---

The Test1 column shows the extra space, and the Test2 column my attempt
to clean things up.

I suppose this behavior is due to the fact that org-sbe is a macro, but
I don't know how tell it to evaluate its arguments and not pass them
literally.

Any suggestion on how to proceed?

Thanks,

Alan

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

* Re: using org-babel-trim in org-sbe?
  2014-04-03 11:48 using org-babel-trim in org-sbe? Alan Schmitt
@ 2014-04-18 13:17 ` Bastien
  2014-04-18 16:51   ` Alan Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2014-04-18 13:17 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> #+TBLFM: $2='(org-sbe spending (c (concat "\"" $1 "\"")))::$3='(org-sbe spending (c (concat "\"" (org-babel-trim $1) "\"")))

You need to swap "concat" and "org-babel-trim" like this:

> #+TBLFM: $2='(org-sbe spending (c (concat "\"" $1 "\"")))::$3='(org-sbe spending (c (org-babel-trim (concat "\"" $1 "\""))))

Otherwise `org-babel-trim' act upon something that is not a string.

Btw, org-trim is enough here.

HTH,

-- 
 Bastien

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

* Re: using org-babel-trim in org-sbe?
  2014-04-18 13:17 ` Bastien
@ 2014-04-18 16:51   ` Alan Schmitt
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Schmitt @ 2014-04-18 16:51 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On 2014-04-18 15:17, Bastien <bzg@gnu.org> writes:

> Hi Alan,
>
> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> #+TBLFM: $2='(org-sbe spending (c (concat "\"" $1 "\"")))::$3='(org-sbe spending (c (concat "\"" (org-babel-trim $1) "\"")))
>
> You need to swap "concat" and "org-babel-trim" like this:
>
>> #+TBLFM: $2='(org-sbe spending (c (concat "\"" $1 "\"")))::$3='(org-sbe spending (c (org-babel-trim (concat "\"" $1 "\""))))
>
> Otherwise `org-babel-trim' act upon something that is not a string.

Ah, thanks, this is good to know.

> Btw, org-trim is enough here.

OK, I've replaced it in other places where I was using it.

Thanks again,

Alan

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

end of thread, other threads:[~2014-04-18 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-03 11:48 using org-babel-trim in org-sbe? Alan Schmitt
2014-04-18 13:17 ` Bastien
2014-04-18 16:51   ` Alan Schmitt

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