emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [RFC] Rewrite radio tables


From: Thorsten Jolitz
Subject: Re: [O] [RFC] Rewrite radio tables
Date: Sun, 24 Aug 2014 22:51:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Thorsten Jolitz <address@hidden> writes:

> Nicolas Goaziou <address@hidden> 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.

Btw, great job - thats quite a complex part of Org-mode, looks like a
lot of work ...

> 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.

Just figured out that I can make the function more generic with a few
changes, now it handles table-formulas and table.el tables too, so FYI: 

,----[ C-h f org-dp-create-table RET ]
| org-dp-create-table is a Lisp function in `org-dp-lib.el'.
| 
| (org-dp-create-table ROW-LST &optional TBLFM TABLE-EL-P)
| 
| Create table with content ROW-LST.
| 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.
| 
| TBLFM, if given, should be a list containing a table formula as
| string. If TABLE-EL-P is non-nil, the table type will be
| 'table.el, otherwise its is 'org by default.
`----

usage:

#+BEGIN_SRC emacs-lisp :results raw
  (org-dp-create-table
   (list
    ;; rows
    (list "col1" "col2" "col3")
    'hline
    (list "a" "b" "c")
    (list 1 2 3)
    'hline
    (list 'x 'y 'z))
   ;; table-formula 
   (list "x=y")
   ;; table type
   ; t)
#+END_SRC

#+results:
| col1 | col2 | col3 |
|------+------+------|
| a    | b    | c    |
| 1    | 2    | 3    |
|------+------+------|
| x    | y    | z    |
#+TBLFM: x=y


-- 
cheers,
Thorsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]