Re: [O] "header-args :eval inline-only" not working

2017-08-26 Thread Nicolas Goaziou
Hello,

"Berry, Charles"  writes:

> Maybe remove the `inline-only' option as a first step.
>
> I have no use for org-export-use-babel, but one thing it does do is
> prevent processing of headers which could be helpful if tricky header
> constructions cause export to fail.

Fair enough. I removed `inline-only' option in master.

Regards,

-- 
Nicolas Goaziou



Re: [O] "header-args :eval inline-only" not working

2017-08-20 Thread Berry, Charles

> On Aug 20, 2017, at 3:21 AM, Nicolas Goaziou  wrote:
> 
> Hello,
> 
> Vikas Rawal  writes:
> 
>> I am on the latest version on org mode ELPA. It is dated August 18,
>> 2017, so should include the commit you mention.
> 
> `org-export-use-babel' is from "master" branch. ELPA provides "maint".
> 
>> But this would prevent exporting all code blocks including inline blocks.
>> 
>> Isn’t it?
>> 
>> There seems no way of separately controlling inline and other blocks.
> 
> There is. You put :eval never-export on all src blocks and :eval t on
> inline code. Note, however, that inline code might call indirectly src
> blocks, so this can lead to odd situations.
> 

There is also :cache, but it has some gotchas, too.

> What you are missing, probably, is some way to set this globally. Alas,
> `org-export-use-babel' or `org-export-babel-evaluate' is not the answer.
> As suggested in the thread you mentioned earlier, we might as well get
> rid of `org-export-use-babel' altogether. It seems to confuse many users
> and isn't very useful.
> 
> WDYT?

Maybe remove the `inline-only' option as a first step.

I have no use for org-export-use-babel, but one thing it does do is prevent 
processing of headers which could be helpful if tricky header constructions 
cause export to fail.


Chuck

Re: [O] "header-args :eval inline-only" not working

2017-08-20 Thread Vikas Rawal

> 
>> I am on the latest version on org mode ELPA. It is dated August 18,
>> 2017, so should include the commit you mention.
> 
> `org-export-use-babel' is from "master" branch. ELPA provides "maint”.

Got it.

>> But this would prevent exporting all code blocks including inline blocks.
>> 
>> Isn’t it?
>> 
>> There seems no way of separately controlling inline and other blocks.
> 
> There is. You put :eval never-export on all src blocks and :eval t on
> inline code. Note, however, that inline code might call indirectly src
> blocks, so this can lead to odd situations.
> 
> What you are missing, probably, is some way to set this globally.

Right.

> Alas,
> `org-export-use-babel' or `org-export-babel-evaluate' is not the answer.
> As suggested in the thread you mentioned earlier, we might as well get
> rid of `org-export-use-babel' altogether. It seems to confuse many users
> and isn't very useful.
> 
> WDYT?
> 

I see no use for org-export-use-babel. But I can only speak for myself here.

In my own case, the src blocks are all R, and inline code is emacs-lisp. So, I 
can use "header-args:R :eval never-export” to turn off evaluation of R code at 
export time.

Vikas


Re: [O] "header-args :eval inline-only" not working

2017-08-20 Thread Nicolas Goaziou
Hello,

Vikas Rawal  writes:

> I am on the latest version on org mode ELPA. It is dated August 18,
> 2017, so should include the commit you mention.

`org-export-use-babel' is from "master" branch. ELPA provides "maint".

> But this would prevent exporting all code blocks including inline blocks.
>
> Isn’t it?
>
> There seems no way of separately controlling inline and other blocks.

There is. You put :eval never-export on all src blocks and :eval t on
inline code. Note, however, that inline code might call indirectly src
blocks, so this can lead to odd situations.

What you are missing, probably, is some way to set this globally. Alas,
`org-export-use-babel' or `org-export-babel-evaluate' is not the answer.
As suggested in the thread you mentioned earlier, we might as well get
rid of `org-export-use-babel' altogether. It seems to confuse many users
and isn't very useful.

WDYT?

Regards,

-- 
Nicolas Goaziou



Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal

>> 
>> I don’t see org-export-use-babel in available options. I cannot customise it.
>> 
>> '(org-export-use-babel (quote inline-only))
>> 
>> Seems to have no effect. Is that so because, as you say later, users are not 
>> supposed to touch this option?
> 
> No.  You must have an older version of org than
> 
> commit 3b5ce449c4b16291ad56e23d5be1e480e57d906f
> Author: Charles Berry >
> Date:   Sat Nov 12 18:54:20 2016 -0800
> 
>Replace `org-export-babel-evaluate' with `org-export-use-babel'
> 
> Did you try `C-h v org-export-use-babel RET', click `customize', etc?

I am on the latest version on org mode ELPA. It is dated August 18, 2017, so 
should include the commit you mention.

> C-h v org-export-use-babel RET’

Does not work (there is no such variable).

> Try
> 
> #+PROPERTY: header-args :eval never-export
> 
> and don't forget C-c C-c to update when you add this.

But this would prevent exporting all code blocks including inline blocks.

Isn’t it?

There seems no way of separately controlling inline and other blocks.

I guess I have to live with that.

Vikas



Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Berry, Charles

> On Aug 19, 2017, at 7:24 PM, Vikas Rawal  
> wrote:
> 
> 
>> 
>> There is a bug in the documentation  -- `org-export-babel-evaluate' is 
>> obsolete. It should say `org-export-use-babel’.
> 
> I don’t see org-export-use-babel in available options. I cannot customise it.
> 
> '(org-export-use-babel (quote inline-only))
> 
> Seems to have no effect. Is that so because, as you say later, users are not 
> supposed to touch this option?

No.  You must have an older version of org than

commit 3b5ce449c4b16291ad56e23d5be1e480e57d906f
Author: Charles Berry 
Date:   Sat Nov 12 18:54:20 2016 -0800

Replace `org-export-babel-evaluate' with `org-export-use-babel'

Did you try `C-h v org-export-use-babel RET', click `customize', etc?

> 
>> But that part of the manual is irrelevant to what the `:eval' header does.  
>> There is no `inline-only' value in either the documentation or in the lisp 
>> code.  So, `inline-only' acts like `yes' for the reason I stated earlier.
>> 
>> 
>>> With current org, I get this behaviour only if I globally set the option. 
>>> But that somehow disables ":results”.
>>> 
>> 
>> Right. `:results' is a babel header.  When babel is off, the babel headers 
>> are not acted upon.
>> 
>> Setting `org-export-use-babel' to `nil' or `inline-only' turns off babel for 
>> src blocks.
>> 
>> 
>> The behavior was purposely changed. With `inline-only' none of the babel 
>> operations will be executed for src blocks  -- i.e. the src blocks and 
>> existing results (if any) will be exported as is.  
>> 
>> Users should avoid touching `org-export-use-babel' for almost all purposes.  
>> It does not do the equivalent of setting `:eval' globally.
>> 
> 
> 
> I just saw this thread: 
> https://lists.gnu.org/archive/html/emacs-orgmode/2017-02/msg00443.html
> 
> I certainly feel that the current behaviour is a regression. The user should 
> have the possibility of controlling globally or buffer-wide whether the 
> source codes are evaluated at the time of export or not. org-export-use-babel 
> does not do that. It turns off babel completely, exporting codes and existing 
> results as is.
> 

Try

#+PROPERTY: header-args :eval never-export

and don't forget C-c C-c to update when you add this.

> This is clearly a regression as far as my use case is concerned.
> 

It seems like `:eval never-export' set globally handles the uses most folks had 
for the old behavior, and I think a bug was fixed by Nicolas in changing it, so 
reverting is probably not going to happen.

Chuck



Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal

> 
> There is a bug in the documentation  -- `org-export-babel-evaluate' is 
> obsolete. It should say `org-export-use-babel’.

I don’t see org-export-use-babel in available options. I cannot customise it.

'(org-export-use-babel (quote inline-only))

Seems to have no effect. Is that so because, as you say later, users are not 
supposed to touch this option?

> But that part of the manual is irrelevant to what the `:eval' header does.  
> There is no `inline-only' value in either the documentation or in the lisp 
> code.  So, `inline-only' acts like `yes' for the reason I stated earlier.
> 
> 
>> With current org, I get this behaviour only if I globally set the option. 
>> But that somehow disables ":results”.
>> 
> 
> Right. `:results' is a babel header.  When babel is off, the babel headers 
> are not acted upon.
> 
> Setting `org-export-use-babel' to `nil' or `inline-only' turns off babel for 
> src blocks.
> 
> 
> The behavior was purposely changed. With `inline-only' none of the babel 
> operations will be executed for src blocks  -- i.e. the src blocks and 
> existing results (if any) will be exported as is.  
> 
> Users should avoid touching `org-export-use-babel' for almost all purposes.  
> It does not do the equivalent of setting `:eval' globally.
> 


I just saw this thread: 
https://lists.gnu.org/archive/html/emacs-orgmode/2017-02/msg00443.html 


I certainly feel that the current behaviour is a regression. The user should 
have the possibility of controlling globally or buffer-wide whether the source 
codes are evaluated at the time of export or not. org-export-use-babel does not 
do that. It turns off babel completely, exporting codes and existing results as 
is.

This is clearly a regression as far as my use case is concerned.

Vikas





Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Berry, Charles

> On Aug 19, 2017, at 6:10 PM, Vikas Rawal  
> wrote:
> 
>> 
>> 
>> The first problem is that you have babel code *inside* a macro.  Since 
>> macros are run after babel executes, nothing will happen.
> 
> From the manual: "Org expands macros at the very beginning of the export 
> process.”
> 
> These macros run fine if I allow code evaluation. Macro replacement happens 
> first, and then the code evaluation. That is not the problem.

You are correct. Sorry.


> 
>> 
>> Next, there is no `:eval inline-only'.  That seem to work only because only 
>> the negative cases are checked. i.e. it is the same as `:eval yes' or even  
>> `:eval yes-please-and-thank-you’.
> 
> Again, from the manual:

> 
> "To evaluate just the inline code blocks, set org-export-babel-evaluate to 
> inline-only. Isolating the option to allow inline evaluations separate from 
> ‘src’ code block evaluations during exports is not for security but for 
> avoiding any delays due to recalculations, such as calls to a remote 
> database.”
> 

There is a bug in the documentation  -- `org-export-babel-evaluate' is 
obsolete. It should say `org-export-use-babel'.  

But that part of the manual is irrelevant to what the `:eval' header does.  
There is no `inline-only' value in either the documentation or in the lisp 
code.  So, `inline-only' acts like `yes' for the reason I stated earlier.


> With current org, I get this behaviour only if I globally set the option. But 
> that somehow disables ":results”.
> 

Right. `:results' is a babel header.  When babel is off, the babel headers are 
not acted upon.

Setting `org-export-use-babel' to `nil' or `inline-only' turns off babel for 
src blocks.


> With older org, everything works as it should.

Older than this:

---
commit ec615b192d703a0201ceefd46897e4636ff00a38
Author: Nicolas Goaziou 
Date:   Thu Apr 28 17:25:31 2016 +0200

Fix `org-export-babel-evaluate' handling 
---


The behavior was purposely changed. With `inline-only' none of the babel 
operations will be executed for src blocks  -- i.e. the src blocks and existing 
results (if any) will be exported as is.  

Users should avoid touching `org-export-use-babel' for almost all purposes.  It 
does not do the equivalent of setting `:eval' globally.

Chuck 



Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal
> 
> 
> The first problem is that you have babel code *inside* a macro.  Since macros 
> are run after babel executes, nothing will happen.

From the manual: "Org expands macros at the very beginning of the export 
process.”

These macros run fine if I allow code evaluation. Macro replacement happens 
first, and then the code evaluation. That is not the problem.

> 
> Next, there is no `:eval inline-only'.  That seem to work only because only 
> the negative cases are checked. i.e. it is the same as `:eval yes' or even  
> `:eval yes-please-and-thank-you’.

Again, from the manual:

"To evaluate just the inline code blocks, set org-export-babel-evaluate to 
inline-only. Isolating the option to allow inline evaluations separate from 
‘src’ code block evaluations during exports is not for security but for 
avoiding any delays due to recalculations, such as calls to a remote database.”

With current org, I get this behaviour only if I globally set the option. But 
that somehow disables ":results”.

With older org, everything works as it should.

Vikas



Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Berry, Charles

> On Aug 19, 2017, at 1:36 PM, Vikas Rawal  
> wrote:
> 
> 
>> On 20-Aug-2017, at 12:57 AM, Nicolas Goaziou  wrote:
>> 
>> Hello,
>> 
>> Vikas Rawal  writes:
>> 
>>> My org-version (latest on org ELPA) is: Org mode version 9.0.9 
>>> (9.0.9-82-gb862c2-elpa @ /Users/vikas/.emacs.d/elpa/org-20170814/)
>>> 
>>> The following is not working: 
>>> 
>>> #+PROPERTY: header-args :eval inline-only
>>> 
>>> ":eval never-export” works; but ":eval inline-only" does not.
>> 
>> What is "not working”?
> 
> ":eval inline-only" has no effect. It still tries to evaluate all code blocks.
> 
> 
>>> I can deal with this by globally changing the option using:
>>> 
>>> (org-export-babel-evaluate (quote inline-only))
>>> 
>>> But this creates another problem. After this, org does not respect 
>>> “:exports results” and exports both the code and results.
>> 
>> Could you provide an ECM?
> 
> Please see the attached file.

Which contains:

#+PROPERTY: header-args :session nss70 :eval inline-only
#+macro: getcell src_emacs-lisp[:results value raw]{(org-table-get-remote-range 
"$1" "$2")}
#+macro: roundnum src_emacs-lisp[:results value raw]{(round (string-to-number 
(org-table-get-remote-range "$1" "$2")))}


> 
> When I export this, it still tries to evaluate the code block 
> ind1_t2_hhd_code. If I use (org-export-babel-evaluate (quote inline-only)), 
> it does not evaluate  ind1_t2_hhd_code code block but it exports both the 
> code and the output.
> 



The first problem is that you have babel code *inside* a macro.  Since macros 
are run after babel executes, nothing will happen.

Next, there is no `:eval inline-only'.  That seem to work only because only the 
negative cases are checked. i.e. it is the same as `:eval yes' or even  `:eval 
yes-please-and-thank-you'.

Instead of a macro containing babel, you can use `call_whatnot(a,b)' statements 
for inline execution, where a src block named `whatnot' handles the desired 
computations.  You can execute these in advance of exporting and specify `:eval 
never-export'.

HTH,

Chuck

p.s. I did not see a bug.  



Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal

> On 20-Aug-2017, at 12:57 AM, Nicolas Goaziou  wrote:
> 
> Hello,
> 
> Vikas Rawal  writes:
> 
>> My org-version (latest on org ELPA) is: Org mode version 9.0.9 
>> (9.0.9-82-gb862c2-elpa @ /Users/vikas/.emacs.d/elpa/org-20170814/)
>> 
>> The following is not working: 
>> 
>> #+PROPERTY: header-args :eval inline-only
>> 
>> ":eval never-export” works; but ":eval inline-only" does not.
> 
> What is "not working”?

":eval inline-only" has no effect. It still tries to evaluate all code blocks.


>> I can deal with this by globally changing the option using:
>> 
>> (org-export-babel-evaluate (quote inline-only))
>> 
>> But this creates another problem. After this, org does not respect “:exports 
>> results” and exports both the code and results.
> 
> Could you provide an ECM?

Please see the attached file.

When I export this, it still tries to evaluate the code block ind1_t2_hhd_code. 
If I use (org-export-babel-evaluate (quote inline-only)), it does not evaluate  
ind1_t2_hhd_code code block but it exports both the code and the output.

Vikas



testecm.org
Description: Binary data




Re: [O] "header-args :eval inline-only" not working

2017-08-19 Thread Nicolas Goaziou
Hello,

Vikas Rawal  writes:

> My org-version (latest on org ELPA) is: Org mode version 9.0.9 
> (9.0.9-82-gb862c2-elpa @ /Users/vikas/.emacs.d/elpa/org-20170814/)
>
> The following is not working: 
>
> #+PROPERTY: header-args :eval inline-only
>
> ":eval never-export” works; but ":eval inline-only" does not.

What is "not working"?

> I can deal with this by globally changing the option using:
>
> (org-export-babel-evaluate (quote inline-only))
>
> But this creates another problem. After this, org does not respect “:exports 
> results” and exports both the code and results.

Could you provide an ECM?

Regards,

-- 
Nicolas Goaziou



[O] "header-args :eval inline-only" not working

2017-08-19 Thread Vikas Rawal
My org-version (latest on org ELPA) is: Org mode version 9.0.9 
(9.0.9-82-gb862c2-elpa @ /Users/vikas/.emacs.d/elpa/org-20170814/)

The following is not working: 

#+PROPERTY: header-args :eval inline-only

":eval never-export” works; but ":eval inline-only" does not.

I can deal with this by globally changing the option using:

(org-export-babel-evaluate (quote inline-only))


But this creates another problem. After this, org does not respect “:exports 
results” and exports both the code and results.

Has anyone else faced this?

If I start my emacs with a -q, emacs picks up the org version that came with my 
version of emacs (25.2.1):

Org-mode version 8.2.10 (release_8.2.10 @ 
/usr/local/Cellar/emacs-mac/emacs-25.2-z-mac-6.5/share/emacs/25.2/lisp/org/)

With this, everything works!  “:eval inline-only” is respected and so is 
“:exports results”.

Have I stumbled on a bug in the current version?

Vikas