From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: Revert orgtbl-create-or-convert-from-region [6.33x]
Date: Mon, 05 Aug 2013 11:16:55 +0200 [thread overview]
Message-ID: <87zjsw33aw.fsf@gmail.com> (raw)
In-Reply-To: 201308050950.16717.daniel.hornung@ds.mpg.de
Daniel Hornung <daniel.hornung@ds.mpg.de> writes:
> I think one great way to increase the usefulness of org-mode would be a
> function which turns a table into a csv or tsv block of text again.
>
> I assume that the functionality exists already in org-table-export, I
> would just wish for this to be exposed as a function which converts the
> table in place instead of writing it into a new file (org-table-export
> does not allow overwriting the current file).
>
> This would finally give a comfortable way to edit tsv or csv tables
> without hassles in emacs.
Would you need something more sophisticated than this?
#+TBLNAME: tbl
| header 1 | header 2 | header 3 |
|----------+----------+----------|
| label1 | 3 | 99 |
| label2 | 2 | 66 |
| label3 | 7 | 231 |
#+TBLFM: $3=$2*33
#+HEADER: :var table=tbl :hlines no
#+HEADER: :results list verbatim
#+begin_src emacs-lisp
(defun tbl2csv (table-as-lisp)
(mapconcat
(lambda (row)
(mapconcat
(lambda (cell)
(format "%s" cell))
row ","))
table-as-lisp ","))
(tbl2csv table)
#+end_src
#+results:
: "header 1,header 2,header 3,label1,3,99,label2,2,66,label3,7,231"
--
cheers,
Thorsten
next prev parent reply other threads:[~2013-08-05 9:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-05 7:49 Bug: Revert orgtbl-create-or-convert-from-region [6.33x] Daniel Hornung
2013-08-05 9:16 ` Thorsten Jolitz [this message]
2013-08-05 9:49 ` Daniel Hornung
2013-08-05 13:26 ` Thorsten Jolitz
2013-08-05 14:07 ` Thorsten Jolitz
2013-08-05 14:19 ` Nick Dokos
2013-08-07 8:49 ` Daniel Hornung
-- strict thread matches above, loose matches on Subject: below --
2013-08-06 5:28 Rustom Mody
2013-08-06 5:31 ` Rustom Mody
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=87zjsw33aw.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).