From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: Bug: Revert orgtbl-create-or-convert-from-region [6.33x] Date: Mon, 05 Aug 2013 16:07:49 +0200 Message-ID: <87wqo06xje.fsf@gmail.com> References: <201308050950.16717.daniel.hornung@ds.mpg.de> <87zjsw33aw.fsf@gmail.com> <201308051149.55650.daniel.hornung@ds.mpg.de> <8738qo8e1f.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6LSE-00089W-LL for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 10:08:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6LS7-0008PF-5y for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 10:08:10 -0400 Received: from plane.gmane.org ([80.91.229.3]:38111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6LS7-0008P3-07 for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 10:08:03 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V6LS6-0006Ft-Ef for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 16:08:02 +0200 Received: from e178056195.adsl.alicedsl.de ([85.178.56.195]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 05 Aug 2013 16:08:02 +0200 Received: from tjolitz by e178056195.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 05 Aug 2013 16:08:02 +0200 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 Thorsten Jolitz writes: > Or use something like this: > > #+begin_src emacs-lisp > (defun tj/insert-exported-table (&optional insertion-point file) > (let ((tmp-file (or file (make-temp-file "foo"))) > (insert-point (or insertion-point (1+ (org-table-end))))) > (org-table-export tmp-file "orgtbl-to-csv") > (goto-char insert-point) > (insert-file-contents tmp-file))) > #+end_src actually, to make it more useful, it should be expanded to something like: #+begin_src emacs-lisp (defun tj/insert-exported-table (&optional insertion-point format file) "Insert table exportet to FILE with function FORMAT. Insertion position is either below the exportet table or INSERTION-POINT." (interactive (cond ((equal current-prefix-arg nil) nil) ((equal current-prefix-arg '(4)) (list (read-number "Insertion Point: "))) ((equal current-prefix-arg '(16)) (list (read-number "Insertion Point: ") ;; enter without double quotes (read-string "Format: "))) (t (list (read-number "Insertion Point: ") (read-string "Format: ") (ido-read-file-name "File: "))))) (let ((tmp-file (or file (make-temp-file "foo"))) (insert-point (or insertion-point (1+ (org-table-end)))) (fmt (or format "orgtbl-to-csv"))) (org-table-export tmp-file fmt) (save-excursion (goto-char insert-point) (insert-file-contents tmp-file)))) #+end_src #+results: : tj/insert-exported-table do 'M-x tj/insert-exported-table' on this table: | header 1 | header 2 | header 3 | |----------+----------+----------| | label1 | 3 | 99 | | label2 | 2 | 66 | | label3 | 7 | 231 | header 1,header 2,header 3 label1,3,99 label2,2,66 label3,7,231 -- cheers, Thorsten