emacs-orgmode
[Top][All Lists]
Advanced

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

[O] New patches WAS Re: [PATCH] inline src block results can be removed


From: Charles C. Berry
Subject: [O] New patches WAS Re: [PATCH] inline src block results can be removed
Date: Mon, 12 Jan 2015 16:48:00 -0800
User-agent: Alpine 2.00 (OSX 1167 2008-08-23)

On Sun, 16 Nov 2014, Nicolas Goaziou wrote:

"Charles C. Berry" <address@hidden> writes:

For now, I'd be willing to make patches that will allow removal of the
inline src block results that do *not* involve these header args:

- :file <fn>
- :wrap <wrapper>
- :results latex html drawer org code

which I can do barely touching `org-babel-insert-result' and this
simplifies matters a lot.

IMO, we're too much focused on the implementation details. We ought to
agree on what should be done first. For example, considering
`org-babel-insert-result' and its RESULT-PARAMS argument, I think the
following makes sense:

 | Param   | Example output                    |
 |---------+-----------------------------------|
 | default | {{{results(42)}}}                 |
 | file    | {{{results(file:something.pdf)}}} |
 | list    |                                   |
 | raw     | 42                                |
 | drawer  |                                   |
 | org     | {{{results(src_org{...})}}}        |
 | html    | {{{results(@@html:...@@)}}}       |
 | latex   | {{{results(@@latex:...@@)}}}      |
 | code    | {{{results(src_xxx{...})}}}        |

Basically, it should be possible to remove any kind of result using
"results" macro, with the exception of "raw".  "list" and "drawer" can
be ignored since there is no inline equivalent.

Another option for "drawer" is to also use export snippets. So,
basically, "drawer something" would generate
{{{results(@@something:...@@)}}}.


I'm back online.

I've attached three patches and two files that show the behavior under the current master (12 Jan 2015, e0879b03d08bb4acc663084076370482f61e8698) and under the patched version.

With the patches, inline source block results can be removed by re-executing the source block if they are wrapped in a `{{{results(...)}}}' macro. The schema for the RESULT-PARAMS is as follows, but see the examples for caveats:

  | Param           | Example output                    |
  |-----------------+-----------------------------------+
  | default/replace | {{{results(=42=)}}}               |
  | list            | \n: - 42\n\n                      |
  | raw             | 42                                |
  | drawer/wrap     | {{{results(42)}}}                 |
  | org             | {{{results(src_org{...})}}}       |
  | html            | {{{results(@@html:...@@)}}}       |
  | latex           | {{{results(@@latex:...@@)}}}      |
  | code            | {{{results(src_emacs-lisp{...})}}}|
  | table           | \n| 42 |\n\n                      |
  |-----------------+-----------------------------------+

where the default is `src_emacs-lisp{42}' and subsequent rows give the `:results' arg.

`:file my.pdf' produces `{{{results([[file:/my.pdf]])}}}', although
link style fontification and open on click are lost as a consequence.

Also `:wrap whatknot' does the obvious.

In addition a few bugs have been squashed (as seen in the difference between the two example files).

The `results' macro is hard coded to wrap `value' except when list, table, or raw is specified as a RESULT-PARAM or when (listp value). And obviously, :file

Users can still customize org-babel-inline-result-wrap, but the macro will wrap the around whatever it yields.

HTH,

Chuck

p.s. The November dates on the patches are a result of using
`git rebase -i' to squash newer commits on top of older ones.

Attachment: 0001-lisp-ob-core.el-Inline-source-block-results-are-repl.patch
Description: ob-core.el patch

Attachment: 0002-ob-exp.el-Enable-removal-of-results.patch
Description: ob-exp.el patch

Attachment: 0003-lisp-ox.el-Enable-removable-inline-src-results.patch
Description: ox.el patch

Attachment: master-inline-src-block.org
Description: master output

Attachment: inline-examples.org
Description: patched output


reply via email to

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