From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: [RFC] Rewrite radio tables Date: Sun, 24 Aug 2014 22:18:03 +0200 Message-ID: <87fvglhcas.fsf@gmail.com> References: <8761hh6662.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLeF2-0000Xw-JG for emacs-orgmode@gnu.org; Sun, 24 Aug 2014 16:18:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLeEx-0008Ut-7c for emacs-orgmode@gnu.org; Sun, 24 Aug 2014 16:18:20 -0400 Received: from plane.gmane.org ([80.91.229.3]:35109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLeEx-0008Ul-0q for emacs-orgmode@gnu.org; Sun, 24 Aug 2014 16:18:15 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XLeEw-00015n-6Y for emacs-orgmode@gnu.org; Sun, 24 Aug 2014 22:18:14 +0200 Received: from e178059182.adsl.alicedsl.de ([85.178.59.182]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Aug 2014 22:18:14 +0200 Received: from tjolitz by e178059182.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Aug 2014 22:18:14 +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 Nicolas Goaziou writes: Hello, > The following patch implements radio tables and `orgtbl-to-...' > functions using Org export engine. The implementation is probably not > totally backward compatible, though. funny, I just wrote `org-dp-create-table' (in https://github.com/tj64/org-dp) a few hours ago, obviously it is not competing with this rather complex framework of Org table creation, but it does its job and might be useful for anybody just looking for a simple way to create a table programmatically. Usage is: #+BEGIN_SRC emacs-lisp :results raw (org-dp-create-table (list '("col1" "col2" "col3") 'hline '("a" "b" "c") '(1 2 3) 'hline '(x y z))) #+END_SRC #+results: | col1 | col2 | col3 | |------+------+------| | a | b | c | | 1 | 2 | 3 | |------+------+------| | x | y | z | implementation is: #+BEGIN_SRC emacs-lisp (defun org-dp-create-table (row-lst) "Create table of type 'org'. ROW-LST is an alist of lists with elements that are contents of a single row's table cells, e.g. (list (list \"col1\" \"col2\" \"col3\") 'hline (list 1 2 3) (list 'x 'y 'z)) for a table with 3 columns and 4 rows, including one horizontal line." ;; table (org-dp-create 'table (mapconcat (lambda (--row-cells) (if (eq --row-cells 'hline) ;; rule rows (org-dp-create 'table-row nil nil nil :type 'rule) ;; standard rows (org-dp-create 'table-row (mapconcat (lambda (--cell-cont) ;; cells (org-dp-create 'table-cell (format "%s" --cell-cont))) --row-cells "") nil nil :type 'standard))) row-lst "") nil nil :type 'org)) #+END_SRC -- cheers, Thorsten