From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [bug, patch, ox] INCLUDE and footnotes Date: Mon, 22 Dec 2014 21:54:12 +0100 Message-ID: <87h9wn4d8r.fsf@nicolasgoaziou.fr> References: <87h9x5hwso.fsf@gmx.us> <87oarcbppe.fsf@nicolasgoaziou.fr> <87fvcozfhf.fsf@gmx.us> <87h9x4bj33.fsf@nicolasgoaziou.fr> <87iohks4ne.fsf@gmx.us> <87d27rbvio.fsf@nicolasgoaziou.fr> <87bnnbhg2x.fsf@gmx.us> <878uifbjc7.fsf@nicolasgoaziou.fr> <87388j9qbv.fsf@gmx.us> <87y4q57t2i.fsf@nicolasgoaziou.fr> <87lhm4n9ky.fsf@pank.eu> <87mw6gyctg.fsf@nicolasgoaziou.fr> <87lhm01mj7.fsf@gmx.us> <87wq5kvt2g.fsf@nicolasgoaziou.fr> <8761d32759.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y39yr-0003wz-Cm for emacs-orgmode@gnu.org; Mon, 22 Dec 2014 15:53:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y39yg-0002V0-Vv for emacs-orgmode@gnu.org; Mon, 22 Dec 2014 15:53:29 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:33925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y39yg-0002To-PP for emacs-orgmode@gnu.org; Mon, 22 Dec 2014 15:53:18 -0500 In-Reply-To: <8761d32759.fsf@gmx.us> (rasmus@gmx.us's message of "Mon, 22 Dec 2014 13:36:34 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org Thanks for the update. Rasmus 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 footnote reference: #+begin_example int x = k[1] #+end_example >> [fn: ref with space] > > While your comment excels in preciseness the terseness makes it hard to > appreciate its depth. In my org-installation "[fn: ref with space]" is > not a valid footnote. Actually, I wanted to say it wasn't valid, then changed my mind, and eventually forgot to remove it from my mail. In a thousand years, scholars might debate over the secret meaning behind these symbols. >> This marker is not necessary since you're not going to add contents >> before (point-min) anyway. A plain number is enough. > > I might if I include *Bar here: > > * Foo > [1] foo > > * Bar > Baz[1] I'm not sure to understand. Would you mind elaborating? > + (unless included > + (org-with-wide-buffer > + (goto-char (point-max)) > + (unless (bolp) (insert "\n")) > + (maphash (lambda (ref def) (insert (format "[%s] %s\n" ref def))) > + footnotes))))))))))) The more I look at it, the more I'm seduced by (unless included (org-with-wide-buffer (goto-char (point-max)) (maphash (lambda (ref def) (insert (format "\n[%s] %s\n" ref def))) footnotes))))))))))) I'm really nitpicking, tho. > ;; Append ID to all footnote references and definitions, so they > ;; become file specific and cannot collide with footnotes in other > ;; included files. > + ;; Further, collect relevant footnotes outside of LINES. You can include it in the previous paragraph, or insert a blank comment line, as it wouldn't survive a M-q. > + (goto-char (1+ (org-element-property :begin reference))) > + (when label Shouldn't these two lines be inverted? > + (let* ((definition (org-footnote-get-definition label)) > + (beginning (copy-marker (nth 1 definition)))) Actually, BEGINNING doesn't need to be a marker either: you always modify buffer after it. Regards,