emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Table (used a "spreadsheet") org-sbe issues when the value is a


From: Alex Bennée
Subject: Re: [O] Table (used a "spreadsheet") org-sbe issues when the value is a string
Date: Wed, 06 Sep 2017 16:32:45 +0100
User-agent: mu4e 0.9.19; emacs 25.2.50.3

Nicolas Goaziou <address@hidden> writes:

> Hello,
>
> Frederick Giasson <address@hidden> writes:
>
>> Now, if I put a string in the format column, I al getting the following:
>>
>> ====================
>>
>> #+NAME: average-dataset-size
>> #+BEGIN_SRC clojure :var f="turtle" :exports none :results value
>> (identity f) #+END_SRC
>>
>> #+RESULTS: average-dataset-size
>> : turtle
>>
>>
>> | Format | Sizes distribution in MB | Average size in MB |
>> |--------+--------------------------+--------------------|
>> | turtle |                          | #ERROR             |
>> #+TBLFM: $3='(org-sbe "average-dataset-size" (f $1))
>>
>> ====================
>
> According to `org-sbe' docstring, it should be
>
>   #+TBLFM: $3='(org-sbe "average-dataset-size" (f $$1))
>
> Documentation could be drastically improved in that area, the manual is
> not even talking about `org-sbe'.

Even this doesn't seem to work. In my case:

    #+name: scramble-string
    #+begin_src emacs-lisp :var str="abcde"
      (apply #'string
             (reverse
              (string-to-list str)))
    #+end_src

    #+RESULTS: scramble-string
    : edcba

So far so good

    #+call: scramble-string(str="whatever-foo")

    #+RESULTS:
    : oof-revetahw

So calling scramble-string works as expected...

    #+tblname: reversed-strings
    | abcde   | #ERROR |
    | flibble | #ERROR |
    | dibble  | #ERROR |
    | xyzzy   | #ERROR |
    | another | #ERROR |
    #+TBLFM: $2='(org-sbe scramble-string (str $$1))

Hmm no dice... the debugger lists:

    Substitution history of formula
    Orig:   '(org-sbe scramble-string (str $$1))
    $xyz->  '(org-sbe scramble-string (str $$1))
    @r$c->  '(org-sbe scramble-string (str $$1))
    $1->    '(org-sbe scramble-string (str $"abcde"))
    Result: #ERROR
    Format: NONE
    Final:  #ERROR

Even calling org-sbe directly from a source block:

    #+name: call-scramble-string-via-sbe
    #+begin_src emacs-lisp :var val="thing"
    (org-sbe scramble-string (str val))
    #+end_src

So is this just broken untested functionality or are there any working
examples from which we could reverse engineer the proper docstring?

--
Alex Bennée



reply via email to

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