[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 22:46:00 +0100 |
User-agent: |
mu4e 0.9.19; emacs 25.2.50.3 |
Nicolas Goaziou <address@hidden> writes:
> Hello,
>
> Alex Bennée <address@hidden> writes:
>
>> 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))
>
> I cannot reproduce it. I get:
Hmm it turns out this interferes:
;; See
http://emacs.stackexchange.com/questions/499/finding-and-executing-org-babel-snippets-programatically
(defun my-babel-hashed-confirm (lang body)
"Check against known hashes before prompting for confirmation.
See `org-confirm-babel-evaluate'."
(let ((check (list lang (md5 body))))
;; If not hashed, prompt
(if (not (member check my-org-babel-hashes))
;; Ask if you want to hash
(if (yes-or-no-p "Store hash for block? ")
;; Hash is added, proceed with evaluation
(progn
(add-to-list 'my-org-babel-hashes check)
'nil)
;; Return 't to prompt for evaluation
't)
(message "Valid hash auto-confirmed")
'nil)))
(setq org-confirm-babel-evaluate 'my-babel-hashed-confirm)
Resetting to org-confirm-babel-evaluate to nil and it works.
>
> #+name: reversed-strings
> | abcde | edcba |
> | flibble | elbbilf |
> | dibble | elbbid |
> | xyzzy | yzzyx |
> | another | rehtona |
> #+TBLFM: $2='(org-sbe scramble-string (str $$1))
>
>> 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
>
> AFAIK, `org-sbe' is limited to tables.
I was trying to replicate the way TBLFM compiles the macro.
>
> Regards,
--
Alex Bennée