From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [RFC] Changing internal representation of back-ends to defstructs Date: Thu, 04 Jul 2013 15:42:31 +0200 Message-ID: <877gh6jvaw.fsf@gmail.com> References: <87r4fgkqql.fsf@gmail.com> <0DC61A88-1225-40A8-851F-D1CE751A505C@gmail.com> <87obaijy8a.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uujnh-0000tY-5d for emacs-orgmode@gnu.org; Thu, 04 Jul 2013 09:42:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uujnf-0004Ot-W7 for emacs-orgmode@gnu.org; Thu, 04 Jul 2013 09:42:21 -0400 Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:38606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uujnf-0004Og-QK for emacs-orgmode@gnu.org; Thu, 04 Jul 2013 09:42:19 -0400 Received: by mail-we0-f173.google.com with SMTP id x54so1138158wes.4 for ; Thu, 04 Jul 2013 06:42:19 -0700 (PDT) In-Reply-To: <87obaijy8a.fsf@gmail.com> (Nicolas Goaziou's message of "Thu, 04 Jul 2013 14:39:17 +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: Carsten Dominik Cc: Org Mode List Completing myself, > I applied the patches. Now, onto orgtbl-to-*. Here is an example illustrating the new features provided by quick and anonymous export back-ends: #+begin_src emacs-lisp (defun my-orgtbl-to-csv () "Insert a comma separated version of Org table at point. The table will be inserted at the end of the buffer. This function makes no assumption about the major mode in the current back-end." (interactive) (unless (org-at-table-p) (user-error "Not at an Org table")) (require 'ox-org) (let ((table (org-export-string-as ;; Export the following table... (buffer-substring-no-properties (org-table-begin) (org-table-end)) ;; ... with the following back-end. (org-export-create-backend :parent 'org :transcoders '((table . (lambda (table contents info) contents)) (table-row . (lambda (row contents info) ;; Ignore table separators. (and (eq (org-element-property :type row) 'standard) (concat contents "\n")))) (table-cell . (lambda (cell contents info) (let ((field (org-quote-csv-field contents))) (if (org-export-get-next-element cell info) (concat field ",") field)))))) ;; Focus on the table only. 'body-only))) ;; Insert TABLE at an appropriate location. For the sake of ;; example, it will be point-max. (goto-char (point-max)) (insert table))) #+end_src -- Nicolas Goaziou