emacs-orgmode
[Top][All Lists]
Advanced

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

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


From: Aaron Ecay
Subject: Re: [O] [PATCH] inline src block results can be removed
Date: Fri, 14 Nov 2014 23:04:06 +0000
User-agent: Notmuch/0.18.1+51~gbbbdf04 (http://notmuchmail.org) Emacs/25.0.50.2 (x86_64-unknown-linux-gnu)

Hi Chuck, Hi Nicolas,

I had a response to Chuck’s earlier message that was sitting around
waiting to be finished...time marches on however.  Apologies.  I think
the following bit is the only part that’s potentially still relevant:

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

I see what you mean.  One option might be to do the following in
org-export-as (untested pseudocode):

(org-macro-initialize-templates)
(let (results-macro)
  (setq results-macro (assoc "results" org-macro-templates))
  (setq org-macro-templates (remove results-macro org-macro-templates))
  (org-macro-replace-all org-macro-templates)
  (org-export-execute-babel-code)
  (org-macro-replace-all (list (or results-macro
                                   (cons "results"
                                         org-default-result-macro) ;; new 
defcustom or defvar
                                   ))))

Back to the present:

2014ko azaroak 14an, Nicolas Goaziou-ek idatzi zuen:
> 
> "Charles C. Berry" <address@hidden> writes:
> 
>> More patches (as you can see). Now ox.el, ob-core.el, and ob-exp.el
>> are patched.
> 
> Thanks.
> 
>> Also, the user can customize org-babel-inline-result-wrap to always
>> get verbatim or otherwise wrap the contents of the macro.
> 
> I don't think this is a good idea.
> 
> If we rely on the macro recognition to properly inline results, setting
> to anything else would break Org. It should be a defconst or we are
> bound to shoot ourselves in the foot.
> 
> If a user wants verbatim output, he will have to somehow generate
> {{{results:=output=}}}, e.g., through appropriate code or parameters.

This is a step back from the present situation, where a user can get
a custom format applied by default to all inline results by setting
‘org-babel-inline-result-wrap’.  I think it’s reasonable for users to
want to set off babel results in a special font (to indicate that
they are automatically generated, e.g.)  This proposal would add an
additional overhead for generating this formatting to every inline
call.

I think the method I sketched above will allow users to redefine the
results macro in the same way as any other macro (via #+MACRO), thus
allowing the possibility of user-specified special formatting.

[...]

>> * lisp/ob-core.el (org-babel-inline-result-wrap): Default is
>> "{{{results(%s)}}}".
> 
> As written earlier, I highly suggest to make it a defconst.

Indeed, this seems correct.  (The “const” designation is just a hint to
users/developers – it doesn’t affect the ability of people who really
want to customize the value to setq it to something else in their init
file.)

> With {{{results(@@backend:...@@)}}}, we don't need the extra trick. Even
> if it is more verbose, I think a regular syntax is better.

This doesn’t mesh with the suggestion to allow the results macro to
supply formatting.

-- 
Aaron Ecay



reply via email to

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