On Wed, 12 Nov 2014, Aaron Ecay wrote: > Hi Chuck, > > 2014ko azaroak 12an, "Charles C. Berry"-ek idatzi zuen: >> >> Inline src blocks cannot update their results --- causing some of us >> heaadaches [1]. >> >> These patches fix that by placing the result of an inline src block in an >> export snippet with a faux :back-end called 'babel'. >> >> So C-c C-c with point on src_R{1+2} will insert `@@babel:3@@'. Updating >> the contents of the inline src block and retyping C-c C-c will update the >> snippet. On export, these snippets are rendered using the verbatim >> transcoder, e.g. \texttt{3} for latex backends. >> >> Support for most backends is provided. >> >> org-babel-execute-buffer will also update such snippets. > > Instead of using an export snippet, which requires per-backend changes, > you could wrap results in a macro, e.g. {{{results(2)}}}. > > Users could customize this macro per-buffer (with the usual #+macro > keyword) to provide their own formatting of inline results. You > could provide the fallback interpretation in the second call to > ‘org-macro-replace-all’ in ‘org-export-as’ (currently responsible > for expanding a few macros like {{{author}}} and {{{date}}}). > > What do you think of this idea? > Aaron, I like the flexibility that macros would allow. Some care needs to be taken with commas, but not a big deal. I don't think the usual #+MACRO works here, as the definition would be found in `org-macro-templates' by the first call and existing stuff would be expanded instead of being left for babel to remove it. But setting it up as a document keyword should work, right? Don't know if there are other gotchas. Maybe a limited collection of formats could be set up to support basic markup options and the macro could choose amongst them with a second arg set by a babel header arg. I am not quite sure how to marry this to header args. Maybe the :wrap header arg should be hijacked for inline src blocks to specify a macro for the results. I mean, does anyone actually use stuff like src_R[:wrap latex]{1+2}? The current result cannot be parsed as an export block, AFAICS. Chuck