From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Hornung Subject: Re: Bug: Revert orgtbl-create-or-convert-from-region [6.33x] Date: Mon, 5 Aug 2013 11:49:52 +0200 Message-ID: <201308051149.55650.daniel.hornung@ds.mpg.de> References: <201308050950.16717.daniel.hornung@ds.mpg.de> <87zjsw33aw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1705992.B874HWQe8G"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6Hol-0001x2-3A for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 06:15:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6Hof-0002Cj-IW for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 06:15:11 -0400 Received: from amailer.gwdg.de ([134.76.10.18]:52824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6Hof-00028v-9y for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 06:15:05 -0400 Received: from [134.76.218.252] (helo=tiersen.localnet) by mailer.gwdg.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1V6HQS-0007xG-12 for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 11:50:04 +0200 In-Reply-To: <87zjsw33aw.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --nextPart1705992.B874HWQe8G Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable On Monday, August 05, 2013 11:16:55 Thorsten Jolitz wrote: > Daniel Hornung 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. > >=20 > > 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). > >=20 > > This would finally give a comfortable way to edit tsv or csv tables > > without hassles in emacs. >=20 > Would you need something more sophisticated than this? >=20 > #+TBLNAME: tbl >=20 > | header 1 | header 2 | header 3 | > | > |----------+----------+----------| > | > | label1 | 3 | 99 | > | label2 | 2 | 66 | > | label3 | 7 | 231 | >=20 > #+TBLFM: $3=3D$2*33 >=20 > #+HEADER: :var table=3Dtbl :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 ",")) >=20 > (tbl2csv table) > #+end_src >=20 > #+results: > : "header 1,header 2,header 3,label1,3,99,label2,2,66,label3,7,231" >=20 > -- > cheers, > Thorsten The idea looks OK, although I did not get it to run with C-x C-e (copied th= e=20 content into a new buffer, entered org-mode and executed the elisp code). = =46or=20 more specific handling of e.g. strings, the code used in http://orgmode.org/w/?p=3Dorg-mode.git;a=3Dblob;f=3Dlisp/org-table.el;hb=3D= HEAD#l601 looks more like it could be used already, though. Plus, it allows to specif= y=20 the column and row separators (e.g. "\t" and "\n"). Cheers, Daniel =2D-=20 Max-Planck-Institute for Dynamics and Self-Organization Laboratory for Fluid Dynamics, Pattern Formation and Biocomplexity Biomedical Physics Group Am Fassberg 17 D-37077 Goettingen (+49) 551 5176 373 --nextPart1705992.B874HWQe8G Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJR/3VAAAoJEB7dAS3xl7EoSNkQAJGxIGCvIlrVAEEMJB7mzgZt FX7m3HO1yobK4aTlMsjMmXS93+aOElKORypNUcHGfwqqFJa6kfZqiELLD2nk0tjD P4eQSSaSWDEAvOUcK3GOpiJ6fZMJGlgqOajNwc7mT9nIJlZwBAcd0VGaLlw8IgiS 6I9YJRBxzhSziouVs0K4ZmsExRr/cGvRx8Ndk90GB4OIfXD9JYc8I0T/lD55zZVF QUUQPwlMSIQkfjooghzZkYcUkQMSdH+i8vQjz5QK+e0vN7EsYEoABR6J+SFdqBle RCKsdIp7iOFRKUQJVx6g5TawcGUVPXbPLS9mZJMn2eb9G/74cWkY1X7ITUBsDpJN jTspshK47A2cYcWWlEMnYa3EDWcgLaGxGG20BOfNKfKQIy/xBSn9GsXASFAVEAat X9Y7EZnwxo4CmOPuSDi3Tabij5MRfXTPtPeZu5g4IFesK7rQD7hTqGIDyscESzYH wjkbeJpgpiH067gLIn+9KI+ra20BUdiD/G4VlxNPLchG7u4EV9zIeb6csAcXkRZR HHNEEhMBKppUUFqSPJkcSJj0s99VFldHi0aDZrGUe5grREmBLb/1jpiri7bKcWVx UKD8w4FnORA8xkN9ha1oKVa5FxlRxvX8KZRuZvt7OuUi0+Hv7G8iRRmkWL2Ar5uD qJtTqALsdPr0eeD62mtx =NYzy -----END PGP SIGNATURE----- --nextPart1705992.B874HWQe8G--