emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [PATCH] Process hlines in imported tables


From: Eric Schulte
Subject: Re: [O] [PATCH] Process hlines in imported tables
Date: Fri, 29 Mar 2013 18:01:21 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Rick Frankel <address@hidden> writes:

> On Fri, Mar 29, 2013 at 09:04:42AM -0600, Eric Schulte wrote:
>> Rick Frankel <address@hidden> writes:
>> 
>> Users may want to insert a "-" in their tables, and I think it would be
>> surprising to magically replace floating "-" characters with hlines.
>> There are numerous existing options for inserting hlines into tables,
>> e.g., the :colnames header argument, using the raw, wrap and org result
>> types and printing literal Org-mode syntax from your block, additionally
>> any result could be passed through an elisp code block which may insert
>> hline symbols at will.
>> 
>> Is there a specific use case which isn't addressed by the existing
>> functionality?
>
> Yes and no. :colnames works, but often the header comes from the
> processing, so they may not be static (I use a lot of call:s). Also,
> I've been having trouble using the output from raw results as input --
> it seems that unless the results are cached (:cache yes), the table is
> not parsed on input, but passed as a multiline string. I was hoping to
> avoid this problem using value returns (now that  Achim has made the
> perl parsing work better). Here's an example (btw, this breaks in 7.4
> as well):
>

Alright, I've just pushed up changes so that org and wrap results will
expand tables (not just raw).  With this change in place you can now use
":results wrap" to get the results you want, and since they are
delimited, you can then re-use these results in later code blocks.

Here's my version of your example run with the latest from git.  Notice
that it is necessary to add header arguments to call lines (because
these arguments control how results are inserted they must be associated
with the call).

* Cache vs. uncached org
#+name: uncached
#+begin_src elisp :results wrap
  "|c1|c2|
  |-
  |a|1|
  |b|2|"
#+end_src

#+RESULTS: uncached
:RESULTS:
| c1 | c2 |
|----+----|
| a  |  1 |
| b  |  2 |
:END:

#+call: uncached() :results wrap

#+RESULTS: uncached():results wrap
:RESULTS:
| c1 | c2 |
|----+----|
| a  |  1 |
| b  |  2 |
:END:

#+name: cached
#+begin_src elisp :results wrap :cache yes
  "|c1|c2|
  |-
  |a|1|
  |b|2|"
#+end_src

#+RESULTS[0faf1fbb046c9e001622c49242322c225811b162]: cached
:RESULTS:
| c1 | c2 |
|----+----|
| a  |  1 |
| b  |  2 |
:END:

#+call: cached() :results wrap

#+RESULTS: cached():results wrap
:RESULTS:
| c1 | c2 |
|----+----|
| a  |  1 |
| b  |  2 |
:END:
Cheers,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

reply via email to

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