emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org, Frederick Giasson <fred@fgiasson.com>
Subject: Re: Table (used a "spreadsheet") org-sbe issues when the value is a string
Date: Wed, 06 Sep 2017 22:46:00 +0100	[thread overview]
Message-ID: <87d173mrfr.fsf@linaro.org> (raw)
In-Reply-To: <87fubzajnu.fsf@nicolasgoaziou.fr>


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Alex Bennée <alex.bennee@linaro.org> 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	other threads:[~2017-09-06 21:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 12:37 Table (used a "spreadsheet") org-sbe issues when the value is a string Frederick Giasson
2016-06-22 23:06 ` Nicolas Goaziou
2017-09-06 15:32   ` Alex Bennée
2017-09-06 16:14     ` Nicolas Goaziou
2017-09-06 21:46       ` Alex Bennée [this message]
2017-09-07 15:21         ` Alex Bennée
2017-09-07 16:04           ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d173mrfr.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=fred@fgiasson.com \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).