From: Karl Voit <devnull@Karl-Voit.at>
To: emacs-orgmode@gnu.org
Subject: [babel] sbe not working properly
Date: Thu, 11 Apr 2013 16:26:12 +0200 [thread overview]
Message-ID: <2013-04-11T16-21-52@devnull.Karl-Voit.at> (raw)
Hi!
I want to define a babel function named epoch2day which I am able to use in a
table to convert UNIX epoch times to Org-mode time stamps:
#+NAME: epoch2day(epoch=1)
#+BEGIN_SRC python :results output
time = epoch
import datetime
strtime = str(time)
datetimestamp = datetime.datetime.utcfromtimestamp(int(strtime[:10]))
print datetimestamp.strftime('[%Y-%m-%d %a %H:%M:%S]')
#+END_SRC
#+RESULTS: epoch2day
: [1970-01-01 Thu 00:00:01]
... this works so far. However, in a table I can't "overwrite" the default
value with a column value:
| epoch | day |
|---------------+---------------------------|
| 1262675465119 | [1970-01-01 Thu 00:00:01] |
#+TBLFM: $2='(sbe epoch2day (epoch $1))
... but $2 should be: [2010-01-05 Tue 07:11:05]
On [1] I found another example:
#+name: add1(x=1) :results silent
#+begin_src python
return x + 1
#+end_src
#+RESULTS: add1
: 2
| foo | bar | 3 | 2 |
#+TBLFM: @1$4='(sbe add1 (x $3))
#+CALL: add1(x=2)
#+RESULTS: add1(x=2)
: 2
So this simple example does not work either at my side[2].
What is my error? Or did I found a bug?
Thanks!
1. http://stackoverflow.com/questions/9595310/org-babel-sbe-syntax
2. Org-mode 1af215bb4668bf3e778175e68fcaf from git
--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
next reply other threads:[~2013-04-11 14:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-11 14:26 Karl Voit [this message]
2013-04-11 18:00 ` [babel] sbe not working properly Darlan Cavalcante Moreira
2013-04-11 19:15 ` Christian Moe
2013-04-12 22:22 ` Eric Schulte
2013-04-13 8:01 ` [babel] sbe not working properly (resolved) Karl Voit
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2013-04-11T16-21-52@devnull.Karl-Voit.at \
--to=devnull@karl-voit.at \
--cc=emacs-orgmode@gnu.org \
--cc=news1142@Karl-Voit.at \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.