emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Single story around subtree export and footnotes, several issues
@ 2022-11-04 21:36 Alain.Cochard
  2022-11-05  4:09 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Alain.Cochard @ 2022-11-04 21:36 UTC (permalink / raw)
  To: Org Mode List


Hello.

I have this file:

   #+STARTUP: fnlocal 
   * headline 1 
   1st call to footnote 1[fn:1]
   [fn:1] footnote 1 body
   * subtree to be exported
   2nd call to footnote 1[fn:1]
   call to footnote 2[fn:2]
   [fn:2] footnote 2 body
   * COMMENT commented headline
   nothing


- 1st issue

I use 'emacs -Q' 

   GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
     3.24.30, cairo version 1.17.4) of 2021-08-07
   Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)

and visit the file with 'C-x C-f'.

I export the subtree with 'C-c C-e C-s l o' on the "subtree to be
exported" headline and get the dreadful

   Wrong type argument: consp, nil

- 2nd issue

If I delete the 1st line (#+STARTUP: fnlocal) and export the subtree
again, it gives the same error message, but, if I save the file with
'C-x C-s', revisit it with 'C-x C-v <RET>' and export the subtree
again, then I get a pdf which is as initially expected, in particular
with the line '2nd call to footnote 1^1 call to footnote 2^2' and both
footnotes.

- 3rd issue
  
I quit emacs, restart it with 'emacs -Q' and revisit the original
file.

I delete the two lines with '[fn:2]', and export the subtree again; I
get the pdf file I expect with "2nd call to footnote 1^1" and the
footnote.

- 4th issue

I quit emacs, restart it with 'emacs -Q', do 'M-x
toggle-debug-on-error', revisit the original file and export the
subtree again.

(I get a Backtrace which is about 21000 characters so I ommit it so
far.)

But the buffer is narrowed; I only see:
  
   2nd call to footnote 1[fn:1]
   call to footnote 2[fn:2]
   [fn:2] footnote 2 body

- 5th issue

After widening it with 'C-x n w', I apparently see my original file,
but if I do 'C-x s', and answer 'y' to the following question
(debug3.org is the name of my file):

   Save file /home/cochard/Org/debug3.org? (y, n, !, ., q, C-r, C-f, d or C-h)

then, using for example 'cat debug3.org' from a terminal, I can see
that the last two lines of the file, i.e.,

   * COMMENT commented headline
   nothing

have disapeared.


Nothing makes sense for me. Thanks in advance for any explanation.

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Single story around subtree export and footnotes, several issues
  2022-11-04 21:36 Single story around subtree export and footnotes, several issues Alain.Cochard
@ 2022-11-05  4:09 ` Ihor Radchenko
  2022-11-05 11:29   ` Alain.Cochard
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2022-11-05  4:09 UTC (permalink / raw)
  To: alain.cochard; +Cc: Org Mode List

Alain.Cochard@unistra.fr writes:

> - 1st issue
>
> I use 'emacs -Q' 
>
>    GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
>      3.24.30, cairo version 1.17.4) of 2021-08-07
>    Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)
>
> and visit the file with 'C-x C-f'.
>
> I export the subtree with 'C-c C-e C-s l o' on the "subtree to be
> exported" headline and get the dreadful
>
>    Wrong type argument: consp, nil

Thanks for reporting and for the detailed reproducer!
Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=3e010d81dcabafcdd97199b8122491a74ad9cbed

> - 4th issue
>
> I quit emacs, restart it with 'emacs -Q', do 'M-x
> toggle-debug-on-error', revisit the original file and export the
> subtree again.
>
> (I get a Backtrace which is about 21000 characters so I ommit it so
> far.)
>
> But the buffer is narrowed; I only see:
>   
>    2nd call to footnote 1[fn:1]
>    call to footnote 2[fn:2]
>    [fn:2] footnote 2 body
>
> - 5th issue
>
> After widening it with 'C-x n w', I apparently see my original file,
> but if I do 'C-x s', and answer 'y' to the following question
> (debug3.org is the name of my file):
>
>    Save file /home/cochard/Org/debug3.org? (y, n, !, ., q, C-r, C-f, d or C-h)
>
> then, using for example 'cat debug3.org' from a terminal, I can see
> that the last two lines of the file, i.e.,
>
>    * COMMENT commented headline
>    nothing
>
> have disapeared.

This is because the error terminated export process in the middle of it.
Org export uses a temporary buffer copy during export. That buffer is cleaned
up to remove commented headings, and whatever parts of the original
buffer that should not be exported. When, exporting subtree, the buffer
may also be narrowed.

You should not know this when things do not err in the middle, which is
now fixed.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Single story around subtree export and footnotes, several issues
  2022-11-05  4:09 ` Ihor Radchenko
@ 2022-11-05 11:29   ` Alain.Cochard
  0 siblings, 0 replies; 3+ messages in thread
From: Alain.Cochard @ 2022-11-05 11:29 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: alain.cochard, Org Mode List


 > Fixed on main.
 > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=3e010d81dcabafcdd97199b8122491a74ad9cbed

Thanks a lot.  I checked that the problem is no longer present for me
either. 

 > This is because the error terminated export process in the middle
 > of it.  Org export uses a temporary buffer copy during export. That
 > buffer is cleaned up to remove commented headings, and whatever
 > parts of the original buffer that should not be exported. When,
 > exporting subtree, the buffer may also be narrowed.
 > 
 > You should not know this when things do not err in the middle,
 > which is now fixed.

Thanks for the explanations; very useful.

 > Thanks for reporting and for the detailed reproducer!

Thanks once more; I spent a whole day on this :-) With non
reproducible features in the process (when using the elpa 9.5.5
version) -- sometimes the buffer was narrowed to nothing and then
widen to the buffer without only the COMMENTed headline missing;
sometimes, after the problem occurred, files with the .org extension
further visited were in Fundamental mode ...

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-05 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 21:36 Single story around subtree export and footnotes, several issues Alain.Cochard
2022-11-05  4:09 ` Ihor Radchenko
2022-11-05 11:29   ` Alain.Cochard

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).