Re: [BUG] Documentation for #+INCLUDE: does not specify order when exporting [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)]

2024-02-12 Thread Ihor Radchenko
Ihor Radchenko  writes:

>> But I do think it would be helpful if the "order" while ex-
>> porting would be documented in a meaningful way.

Details of the export flow have been added to the manual.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=46cf76259
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5cbaa8747

Fixed, on main.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] Documentation for #+INCLUDE: does not specify order when exporting [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)]

2023-04-08 Thread Ihor Radchenko
Tim Landscheidt  writes:

> But why did I spend a few hours debugging this before final-
> ly understanding Org's mode of operation?  The first sen-
> tence of the documentation in "13.4 Include Files" reads:
>
> | During export, you can include the content of another file.
> | […]
>
> I'm not a native speaker, but the word "during" drew the
> mental image for me that, when exporting, Org starts at the
> top of the document, reads through to the end, and if en-
> counters a "#+INCLUDE:" statement /during/ that, it includes
> the referenced file at that point.
>
> Now the Org manual is already beset with examples that look
> as if someone complained about something not being document-
> ed somewhere, and then someone adding one sentence just that
> somewhere, so I don't want to add to that with "just a quick
> fix".
>
> But I do think it would be helpful if the "order" while ex-
> porting would be documented in a meaningful way.

Sure. We can add a section summarizing the export process at the end of
"13 Exporting". Patches welcome!

The export sequence is implemented in `org-export-as'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 

Confirmed.



[BUG] Documentation for #+INCLUDE: does not specify order when exporting [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)]

2023-04-08 Thread Tim Landscheidt
With the Org file:

| #+BEGIN_SRC python :results silent :exports results
|   test = '1'
|   with open('test-a.log', 'w') as f:
|   f.write(f'Test {test}a\n')
|   with open('test-b.log', 'w') as f:
|   f.write(f'Test {test}b\n')
| #+END_SRC

| Test, part A:

| #+INCLUDE: "test-a.log" verbatim

| Test, part B:

| #+INCLUDE: "test-b.log" verbatim

and test-a.log and test-b.log not existing, on the first
(unsuccessful) export, the error:

| org-export-expand-include-keyword: Cannot include file /tmp/test-a.log

is displayed.  However, if these files already exist, they
are included as is, and /after/ that inclusion, the Python
source block is executed.

This means that if one changes "test = '1'" to "test = '2'"
in the Python source block, one has to export the Org file
twice to see the changed result in the export.

Technically, this is probably the "correct" behaviour as
otherwise the order of execution would be very hard to de-
termine.

But why did I spend a few hours debugging this before final-
ly understanding Org's mode of operation?  The first sen-
tence of the documentation in "13.4 Include Files" reads:

| During export, you can include the content of another file.
| […]

I'm not a native speaker, but the word "during" drew the
mental image for me that, when exporting, Org starts at the
top of the document, reads through to the end, and if en-
counters a "#+INCLUDE:" statement /during/ that, it includes
the referenced file at that point.

Now the Org manual is already beset with examples that look
as if someone complained about something not being document-
ed somewhere, and then someone adding one sentence just that
somewhere, so I don't want to add to that with "just a quick
fix".

But I do think it would be helpful if the "order" while ex-
porting would be documented in a meaningful way.