emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] what's wrong with this sbe?


From: Myles English
Subject: Re: [O] what's wrong with this sbe?
Date: Mon, 05 Mar 2012 15:29:04 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Thanks Seb,

* TODO Fix the word wrapping in my emails               :gnus:
  <SCHEDULED: ASAP>

>> On Mon, 05 Mar 2012 15:09:49 +0100, Sebastien Vauban said:

  > Hi Myles, Myles English wrote:
  >> Please could tell me where I am going wrong with this?  I just
  >> can't get the source block to put a result in the table.
  >> 
  >> #+name: workingDays #+BEGIN_SRC emacs-lisp :var hms="0" (require
  >> 'org-timer) (/ (org-timer-hms-to-secs hms) (* 60 60 8)) #+END_SRC
  >> 
  >> #+call: workingDays(hms="236:30:00")
  >> 
  >> #+RESULTS: workingDays(hms="236:30:00") : 29
  >> 
  >> | Days | H:M:S | |--------+-----------| | #ERROR |
  >> 236:30:00 | #+TBLFM: @2$1='(sbe "workingDays" (hms @2$2))

  > This is because the string you send in the `sbe' call should be
  > (double-)quoted, as in:

  >   | Days | H:M:S | |------+-------------| | 29 |
  > "236:30:00" | #+TBLFM: @2$1='(sbe workingDays (hms @2$2))

  > This is really annoying for most cases, and dates back from a
  > problem to distinguish between references and strings, at some
  > point.

Yes it is quite annoying.  After your help I tried various combinations
of (quote),(print),(string),(number-to-string) and (concat), both in the
TBLFM line and in the source block but found that this is the only way
to get a slightly unsatisfactory result:

| Days |     H:M:S |             |
|------+-----------+-------------|
|   29 | 236:30:00 | "236:30:00" |
|      |           |             |
#+TBLFM: @2$3='(print (concat "\"" @2$2 "\""))::@2$1='(sbe workingDays (hms 
@2$3))


  > I wonder whether this heavy constraint (strings must be enclosed)
  > still applies or not.

  > Best regards, Seb

  > PS- No need to quote the function name...

  > -- Sebastien Vauban

Thanks again,

Myles



reply via email to

[Prev in Thread] Current Thread [Next in Thread]