From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Footnote sorting bug Date: Mon, 07 Mar 2011 14:06:40 -0500 Message-ID: <87y64qsqbj.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=36763 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pwflb-0007VX-E9 for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 14:06:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwflT-0001fL-Ls for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 14:06:51 -0500 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:52545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwflT-0001f0-Gj for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 14:06:43 -0500 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 409CA20861 for ; Mon, 7 Mar 2011 14:06:42 -0500 (EST) Received: from archdesk (67-197-63-212.rh2.dyn.cm.comporium.net [67.197.63.212]) by mail.messagingengine.com (Postfix) with ESMTPSA id F2E99445ABF for ; Mon, 7 Mar 2011 14:06:41 -0500 (EST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Sorting footnotes when org-footnote-section is nil can have very destructive consequences. For instance, the following file... --8<---------------cut here---------------start------------->8--- * Heading one A footnote.[fn:one] [fn:one] A footnote Another footnote.[fn:two] [fn:two] Another footnote A third footnote.[fn:three] [fn:three] A third * Heading two Some text --8<---------------cut here---------------end--------------->8--- ...loses the second heading when sorted.... --8<---------------cut here---------------start------------->8--- * Heading one A footnote.[fn:one] Another footnote.[fn:two] A third footnote.[fn:three] [fn:one] A footnote [fn:two] Another footnote* Heading two Some text [fn:three] A third --8<---------------cut here---------------end--------------->8--- I traced the problem to an extra forward-line added to org-footnote-goto-local-insertion-point with commit 145109dc4a6f161e4ad826bea9cc970363649280, but seems to have had some unintended consequences for org buffers. The following patch fixes the sorting problem in org buffers. AFAICT, it has no effect on footnote insertion in message mode buffers with signatures. (Unfortunately, footnote sorting in message buffers with signatures is broken both before and after this patch.) --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index b6a9bca..d28161e 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -511,8 +511,7 @@ ENTRY is (fn-label num-mark definition)." (beginning-of-line 0)) (if (looking-at "[ \t]*#\\+TBLFM:") (beginning-of-line 2)) (end-of-line 1) - (skip-chars-backward "\n\r\t ") - (forward-line)) + (skip-chars-backward "\n\r\t ")) (defun org-footnote-delete (&optional label) "Delete the footnote at point. --8<---------------cut here---------------end--------------->8--- Best, Matt