* Babel - :export-dir and :file-ext arguments cause all blocks to emit files
@ 2018-05-24 21:50 Alex Fenton
2018-05-24 23:13 ` Nicolas Goaziou
0 siblings, 1 reply; 9+ messages in thread
From: Alex Fenton @ 2018-05-24 21:50 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 939 bytes --]
Hi,
As far I understand it, |:output-dir| and |:file-ext| that were intended
to be used in the global document header, applying to all blocks.
However, it seems to mean that all blocks regardless of their :results
args then emit a file, and put their output as a [file:] link. It's not
clear from the docs why this happens.
Am I missing something, or does this mean that these arguments are
useless unless a document happens only to emit graphics from blocks? At
the moment, the blocks (R, as it happens) are meant to sometimes emit
scalars, sometimes literal latex, sometimes tables to be formatted by
orgs, and sometimes graphics. But all the non-graphics are at the moment
being stuffed into (non-working) PDF files.
Following a discussion and suggested, but not-working solution at:
https://emacs.stackexchange.com/questions/41618/org-modes-output-dir-and-file-ext-arguments-cause-all-output-to-be-saved-to
Thanks
alex
[-- Attachment #2: Type: text/html, Size: 1651 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Babel - :export-dir and :file-ext arguments cause all blocks to emit files
2018-05-24 21:50 Babel - :export-dir and :file-ext arguments cause all blocks to emit files Alex Fenton
@ 2018-05-24 23:13 ` Nicolas Goaziou
2018-05-25 5:32 ` Alex Fenton
2018-05-25 13:47 ` Aaron Ecay
0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2018-05-24 23:13 UTC (permalink / raw
To: Alex Fenton; +Cc: emacs-orgmode
Hello,
Alex Fenton <alex@pressure.to> writes:
> As far I understand it, |:output-dir| and |:file-ext| that were
> intended to be used in the global document header, applying to all
> blocks.
>
> However, it seems to mean that all blocks regardless of their :results
> args then emit a file, and put their output as a [file:] link. It's
> not clear from the docs why this happens.
>
> Am I missing something, or does this mean that these arguments are
> useless unless a document happens only to emit graphics from blocks?
> At the moment, the blocks (R, as it happens) are meant to sometimes
> emit scalars, sometimes literal latex, sometimes tables to be
> formatted by orgs, and sometimes graphics. But all the non-graphics
> are at the moment being stuffed into (non-working) PDF files.
>
> Following a discussion and suggested, but not-working solution at:
> https://emacs.stackexchange.com/questions/41618/org-modes-output-dir-and-file-ext-arguments-cause-all-output-to-be-saved-to
I agree something is cheesy here.
According to `org-babel-execute-src-block', if :file is set (it can also
be forged from :file-ext and :output-dir according to
`org-babel-generate-file-param'), results become the filename.
Also, according to `org-babel-merge-params' both :file and :file-ext
trump :results value, i.e., they automatically imply "file" in :results.
and "results" in :exports.
At this point, I'm not sure about :export, but I think it should be the
other way for :results. IOW, :file and :file-ext should be taken into
consideration only when :results contains "file".
WDYT?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Babel - :export-dir and :file-ext arguments cause all blocks to emit files
2018-05-24 23:13 ` Nicolas Goaziou
@ 2018-05-25 5:32 ` Alex Fenton
2018-05-25 13:47 ` Aaron Ecay
1 sibling, 0 replies; 9+ messages in thread
From: Alex Fenton @ 2018-05-25 5:32 UTC (permalink / raw
Cc: emacs-orgmode
On 25/05/18 01:13, Nicolas Goaziou wrote:
> Hello,
>
> Alex Fenton <alex@pressure.to> writes:
>
>> As far I understand it, |:output-dir| and |:file-ext| that were
>> intended to be used in the global document header, applying to all
>> blocks.
>>
>> However, it seems to mean that all blocks regardless of their :results
>> args then emit a file, and put their output as a [file:] link. It's
>> not clear from the docs why this happens.
>>
>> Am I missing something, or does this mean that these arguments are
>> useless unless a document happens only to emit graphics from blocks?
>> At the moment, the blocks (R, as it happens) are meant to sometimes
>> emit scalars, sometimes literal latex, sometimes tables to be
>> formatted by orgs, and sometimes graphics. But all the non-graphics
>> are at the moment being stuffed into (non-working) PDF files.
>>
>> Following a discussion and suggested, but not-working solution at:
>> https://emacs.stackexchange.com/questions/41618/org-modes-output-dir-and-file-ext-arguments-cause-all-output-to-be-saved-to
> I agree something is cheesy here.
>
> According to `org-babel-execute-src-block', if :file is set (it can also
> be forged from :file-ext and :output-dir according to
> `org-babel-generate-file-param'), results become the filename.
>
> Also, according to `org-babel-merge-params' both :file and :file-ext
> trump :results value, i.e., they automatically imply "file" in :results.
> and "results" in :exports.
>
> At this point, I'm not sure about :export, but I think it should be the
> other way for :results. IOW, :file and :file-ext should be taken into
> consideration only when :results contains "file".
>
> WDYT?
>
> Regards,
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Babel - :export-dir and :file-ext arguments cause all blocks to emit files
2018-05-24 23:13 ` Nicolas Goaziou
2018-05-25 5:32 ` Alex Fenton
@ 2018-05-25 13:47 ` Aaron Ecay
2018-05-25 19:52 ` Alex Fenton
1 sibling, 1 reply; 9+ messages in thread
From: Aaron Ecay @ 2018-05-25 13:47 UTC (permalink / raw
To: Nicolas Goaziou, Alex Fenton; +Cc: emacs-orgmode
Hi Nicolas, hi Alex,
First of all, no issue arises with :output-dir alone. It can be
specified as a global header arg without issue.
The situation with :file is that it (currently and at all relevant times
in the past AFAIK) implies :results file. That is because it would be a
little strange if:
#+begin_src R :file foo.pdf
...
#+end_src
did not result in the output going to foo.pdf
I designed :file-ext as a direct replacement for :file. That is, instead
of the above, one would specify:
#+name: foo
#+begin_src R :file-ext pdf
...
#+end_src
and get the same result. IOW, the design was *not* for :file-ext to be
specified globally. This perhaps could have been documented better when
it was first introduced, and I see that subsequent changes in the manual
have not made things clearer.
The change Nicolas proposes is how I would make :file-ext work if I were
writing it from scratch today, with the benefit of hindsight. I worry
that introducing it would break org documents in the wild, but maybe it is
worth it. Itʼs probably possible to write an org-lint check for the most
common broken case (where :file-ext is specified directly on a block, but
:results file is not. This check would not catch a case where :file-ext
was specified via a property for a buffer/subtree of blocks all of which
are supposed to produce file results. Such a case should be rare, but
itʼs not impossible.) Iʼm still not 100% convinced that the breakage
would be worth it, but I suppose I would incline towards that view.
OTOH I do not think the proposed change makes sense for :file, because
it would lead to a nonsensical situation in the case of the first block
in this email. It never has made sense to specify :file by inheritance,
so I donʼt think anything should change for that case.
--
Aaron Ecay
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Babel - :export-dir and :file-ext arguments cause all blocks to emit files
2018-05-25 13:47 ` Aaron Ecay
@ 2018-05-25 19:52 ` Alex Fenton
2018-05-27 16:40 ` Aaron Ecay
0 siblings, 1 reply; 9+ messages in thread
From: Alex Fenton @ 2018-05-25 19:52 UTC (permalink / raw
To: emacs-orgmode
Hi Aaron
> First of all, no issue arises with :output-dir alone. It can be
> specified as a global header arg without issue.
Yes, now I check again that's true. Thank you for clearing that up.
> I designed :file-ext as a direct replacement for :file. That is, instead
> of the above, one would specify:
>
> #+name: foo
> #+begin_src R :file-ext pdf
> ...
> #+end_src
>
> and get the same result. IOW, the design was *not* for :file-ext to be
> specified globally.
Now I understand how it was intended (a shortcut for people who are
scrupulous about using #+NAME) it makes sense. I was thinking it was
meant as an easy way to switch globally between different formats
(sometimes I want PDF for ease, sometimes I want Tikz for
publication-quality, sometimes I want SVG for online etc.).
> The change Nicolas proposes is how I would make :file-ext work if I were
> writing it from scratch today, with the benefit of hindsight. I worry
> that introducing it would break org documents in the wild, but maybe it is
> worth it.
You (all) are a better judge of what is a reasonable non-back-compatible
change.
all the best
alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Babel - :export-dir and :file-ext arguments cause all blocks to emit files
2018-05-25 19:52 ` Alex Fenton
@ 2018-05-27 16:40 ` Aaron Ecay
2018-05-27 19:54 ` Nicolas Goaziou
0 siblings, 1 reply; 9+ messages in thread
From: Aaron Ecay @ 2018-05-27 16:40 UTC (permalink / raw
To: Alex Fenton, emacs-orgmode
Hi Alex,
2018ko maiatzak 25an, Alex Fenton-ek idatzi zuen:
[...]
> Now I understand how it was intended (a shortcut for people who are
> scrupulous about using #+NAME) it makes sense.
Iʼve pushed commit 1643f70d3 to master which documents this behavior.
> I was thinking it was meant as an easy way to switch globally between
> different formats (sometimes I want PDF for ease, sometimes I want
> Tikz for publication-quality, sometimes I want SVG for online etc.).
I agree it would be nice. You can have executable elisp in header
arguments, so it is possible to do something like this (though ugly,
since the same snippet has to be duplicated across every src block).
One example of what I mean is at
<https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html>;
search for “by-backend” in the page.
[...]
>
> You (all) are a better judge of what is a reasonable non-back-compatible
> change.
Iʼm inclined not to make the change now, but (hopefully remember to)
revisit it when Org 10 is imminent.
Thanks for raising the issue,
--
Aaron Ecay
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Babel - :export-dir and :file-ext arguments cause all blocks to emit files
2018-05-27 16:40 ` Aaron Ecay
@ 2018-05-27 19:54 ` Nicolas Goaziou
2018-05-27 20:39 ` Aaron Ecay
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2018-05-27 19:54 UTC (permalink / raw
To: Alex Fenton; +Cc: emacs-orgmode
Hello,
Aaron Ecay <aaronecay@gmail.com> writes:
> Iʼve pushed commit 1643f70d3 to master which documents this behavior.
Thank you. Please have a look at the consistency edits I made to it.
> Iʼm inclined not to make the change now, but (hopefully remember to)
> revisit it when Org 10 is imminent.
I agree now is clearly not the time for such a change. We could however
try to make that right as soon as Org 9.2 is released.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Babel - :export-dir and :file-ext arguments cause all blocks to emit files
2018-05-27 19:54 ` Nicolas Goaziou
@ 2018-05-27 20:39 ` Aaron Ecay
2018-05-27 20:50 ` Nicolas Goaziou
0 siblings, 1 reply; 9+ messages in thread
From: Aaron Ecay @ 2018-05-27 20:39 UTC (permalink / raw
To: Nicolas Goaziou; +Cc: emacs-orgmode
Hi Nicolas,
2018ko maiatzak 27an, Nicolas Goaziou-ek idatzi zuen:
>
> Hello,
>
> Aaron Ecay <aaronecay@gmail.com> writes:
>
>> Iʼve pushed commit 1643f70d3 to master which documents this behavior.
>
> Thank you. Please have a look at the consistency edits I made to it.
Thanks very much.
(As an aside: is org-footnote-auto-adjust TRT for the manual? It seems
like it will lead to lots of churn every time a footnote is added or
removed...)
--
Aaron Ecay
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Babel - :export-dir and :file-ext arguments cause all blocks to emit files
2018-05-27 20:39 ` Aaron Ecay
@ 2018-05-27 20:50 ` Nicolas Goaziou
0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2018-05-27 20:50 UTC (permalink / raw
To: emacs-orgmode
Aaron Ecay <aaronecay@gmail.com> writes:
> (As an aside: is org-footnote-auto-adjust TRT for the manual? It seems
> like it will lead to lots of churn every time a footnote is added or
> removed...)
This is a trade-off, indeed. It adds churn in diffs, but it's more
natural to follow when editing or simply reading the Org file.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-05-27 20:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-24 21:50 Babel - :export-dir and :file-ext arguments cause all blocks to emit files Alex Fenton
2018-05-24 23:13 ` Nicolas Goaziou
2018-05-25 5:32 ` Alex Fenton
2018-05-25 13:47 ` Aaron Ecay
2018-05-25 19:52 ` Alex Fenton
2018-05-27 16:40 ` Aaron Ecay
2018-05-27 19:54 ` Nicolas Goaziou
2018-05-27 20:39 ` Aaron Ecay
2018-05-27 20:50 ` Nicolas Goaziou
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.