Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-24 Thread Rasmus
Hi, Nicolas Goaziou m...@nicolasgoaziou.fr writes: I think you can push once the issues above are fixed. Thank you for the work. Pushed! However, this raises a question: why are we modifying definition at all? We are only interested in its new label, which we can get without modifying

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-24 Thread Rasmus
Hi, Nicolas Goaziou m...@nicolasgoaziou.fr writes: You can push the patch once this is fixed. Pushed. See general comments in the other mail. One funny thing I observed was that the following test fails, but only when run via make test, not from e.g. my own Emacs or emacs -q and emacs -q

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-24 Thread Nicolas Goaziou
Hello, Rasmus ras...@gmx.us writes: Pushed. See general comments in the other mail. Thank you. One funny thing I observed was that the following test fails, but only when run via make test, not from e.g. my own Emacs or emacs -q and emacs -q -nw. I don't see any failing test. When

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-24 Thread Rasmus
Hi, Nicolas Goaziou m...@nicolasgoaziou.fr writes: When running through make test (org-current-level) evaluate to one (before expansion) even when narrowed (should be nil). Why? `org-current-level' ignores narrowing. Perhaps something changed recently then. In the version I was testing

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-24 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes: One funny thing I observed was that the following test fails, but only when run via make test, not from e.g. my own Emacs or emacs -q and emacs -q -nw. I don't see any failing test. When I use something like the attached patch, make test goes

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-22 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: That's a nice solution. Implemented in attached patch. Thanks. Two minor comments follow. Should this be added to ORG-NEWS? Is a feature or a bug-fix? Bug-fix I'd say. There was an attempt to do it (see MINLEVEL binding), but it was incorrect. +;; Add

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-22 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: Thanks for the comments. I managed to make the patch less complicated. Thanks. Another round of comments follows. I did not know markers but they seem perfect in this case. The manual mentions setting markers to nil after use. I guess it's not necessary here

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-22 Thread Rasmus
Hi, Thanks again! Nicolas Goaziou m...@nicolasgoaziou.fr writes: I did not know markers but they seem perfect in this case. The manual mentions setting markers to nil after use. I guess it's not necessary here since they are in a (let ⋯)? It is. Binding between the symbol and the marker

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-22 Thread Nicolas Goaziou
Thanks for the update. Rasmus ras...@gmx.us writes: I see. I disagree that it's more since it's directly inside a loop over org-footnote-re. So if we are not at a footnote-{reference,definition} it's probably a bug in the regexp. Pleonasm. Note that the regexp can match even if not at a

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-22 Thread Rasmus
Hi, I fixed the nitpicks, but no major changes. Nicolas Goaziou m...@nicolasgoaziou.fr writes: Pleonasm. Note that the regexp can match even if not at a footnote reference [...]: Fair enough. In a thousand years, scholars might debate over the secret meaning behind these symbols. Let's

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-22 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: * Foo [1] foo * Bar Baz[1] I'm not sure to understand. Would you mind elaborating? If I have #+INCLUDE: example-above.org::*Bar then point-min of the include area will be pushed forward by four since the definition of [1] is changed to fn:1-1 or something

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-22 Thread Rasmus
Hi, Nicolas Goaziou m...@nicolasgoaziou.fr writes: Rasmus ras...@gmx.us writes: * Foo [1] foo * Bar Baz[1] I'm not sure to understand. Would you mind elaborating? If I have #+INCLUDE: example-above.org::*Bar then point-min of the include area will be pushed forward by four since the

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: Thanks for the notes. Hopefully patch one if good now. Thanks. Some comments follow. * ox.el (org-export--prepare-file-contents): Preserve footnotes when using the LINES argument. New optional argument FOOTNOTES. (org-export-expand-include-keyword): New

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: Here's a new version of the second patch with tests. Thanks. Some comments follow. The recognition regexp is still not great, but the idea of the regexp is to only act on includes where there's no :minlevel already and no plain words (most obviously src and

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Rasmus
Hi, Thanks for the comments. I've attached a new version. Nicolas Goaziou m...@nicolasgoaziou.fr writes: The recognition regexp is still not great, but the idea of the regexp is to only act on includes where there's no :minlevel already and no plain words (most obviously src and example,

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: Thanks for the comments. I've attached a new version. Thanks. Nicolas Goaziou m...@nicolasgoaziou.fr writes: This is not necessary. Even if :minlevel is used on these include keywords, its value is ignored when inserting contents of the file. It's not neural

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes: I suggest to do it differently, then. We first process every include keyword in the document, but simply add a text property (e.g. `org-include-level') over them specifying [...] Include lines are not modified and this variable only applies to

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Rasmus
Hi, Thanks for the comments. I managed to make the patch less complicated. Nicolas Goaziou m...@nicolasgoaziou.fr writes: + (let* ((lines (and lines (split-string lines -))) + (lbeg (and lines (string-to-number (car lines + (lend (and lines (string-to-number (cadr

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-19 Thread Rasmus
Rasmus ras...@gmx.us writes: AFAICT, there's no reason to include a rule about whitespace separating anything. Just make sure that any INCLUDE keyword that doesn't have a :minlevel property gets one set to 1+N, where N is the current level (or 0 if at top level). Another option is to delay

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-18 Thread Rasmus
Hi, Thanks for the notes. Hopefully patch one if good now. Patch two needs tests, but I can write those if we agree to impose minlevel automatically. Nicolas Goaziou m...@nicolasgoaziou.fr writes: AFAICT, there's no reason to include a rule about whitespace separating anything. Just make

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-17 Thread Nicolas Goaziou
Hello, Rasmus ras...@gmx.us writes: Attached is a patch that enables footnotes in INCLUDEd documents when using :lines and friends. It stores the footnotes in a hash-table initialized in `org-export-expand-include-keyword' and updated via `org-export--prepare-file-contents'. The footnotes

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-13 Thread Rasmus
Hi, Attached is a patch that enables footnotes in INCLUDEd documents when using :lines and friends. It stores the footnotes in a hash-table initialized in `org-export-expand-include-keyword' and updated via `org-export--prepare-file-contents'. The footnotes are then inserted when all include

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-10 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: Nicolas Goaziou m...@nicolasgoaziou.fr writes: I think required definitions should be extracted from the included file and inserted at the end of the source file, without any footnote section. The hard solution. I will look into it. It may not be that hard,

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-10 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes: Rasmus ras...@gmx.us writes: Nicolas Goaziou m...@nicolasgoaziou.fr writes: I think required definitions should be extracted from the included file and inserted at the end of the source file, without any footnote section. The hard solution.

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-10 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: I'm curious about the hash table. (info (elisp) Hash Tables) says For smaller tables (a few tens of elements) alists may still be faster [than hash tables]. True, but then, both a small table and a small alist are very fast. OTOH, hash tables scale better. For

[O] [bug, patch, ox] INCLUDE and footnotes

2014-12-09 Thread Rasmus
Hi, When using LINES in `org-export--prepare-file-contents' the footnotes section is not preserved causing export to fail. Minimal example $ cat t{1,2}.org # this is t1.org * intro foo[fn:1] * sec2 bar * Footnotes [fn:1] baz # this is t2.org #+INCLUDE: ./t1.org::#intro And export t2.org.

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-09 Thread Rasmus
Rasmus ras...@gmx.us writes: The attached patch fixes this by explicitly saving the footnote section As per usual my first patch is dodgy. It occurred to me that Org can handle several footnote sections (that's how #+INCLUDE supports footnotes, I guess). The attached patch how supports export

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-09 Thread Nicolas Goaziou
Hello, Rasmus ras...@gmx.us writes: When using LINES in `org-export--prepare-file-contents' the footnotes section is not preserved causing export to fail. Minimal example $ cat t{1,2}.org # this is t1.org * intro foo[fn:1] * sec2 bar * Footnotes [fn:1] baz # this is t2.org

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-09 Thread Rasmus
Hi, Nicolas Goaziou m...@nicolasgoaziou.fr writes: First `org-footnote-section' could be nil, in which case there is no headline to look after. Sure. Also, there may be multiple footnote sections in the included document, or even some footnote definitions inside and some outside the single

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-09 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes: Clearly the current situation is not satisfactory (You can use :lines, but only if no footnotes are present. . . IOW, :lines supports a subset of Org syntax.). I prefer converting [fn:N] references to [fn::FOOTNOTE] (see my other email). Any obvious downsides?

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-09 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes: Rasmus ras...@gmx.us writes: Clearly the current situation is not satisfactory (You can use :lines, but only if no footnotes are present. . . IOW, :lines supports a subset of Org syntax.). I prefer converting [fn:N] references to