Nicolas Goaziou <[email protected]> writes:

> Hello,
>
> Alex Bennée <[email protected]> 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

Reply via email to