From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Footnote sorting bug Date: Mon, 07 Mar 2011 20:04:00 -0500 Message-ID: <8762rul8xr.fsf@fastmail.fm> References: <87y64qsqbj.fsf@fastmail.fm> <87mxl6sfby.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=38285 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwlLI-0000YB-6g for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 20:04:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwlLH-00079S-0L for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 20:04:04 -0500 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:49138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwlLG-00079N-Ri for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 20:04:02 -0500 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 43C4A207A8 for ; Mon, 7 Mar 2011 20:04:02 -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 F2A18407C37 for ; Mon, 7 Mar 2011 20:04:01 -0500 (EST) In-Reply-To: <87mxl6sfby.fsf@fastmail.fm> (Matt Lundin's message of "Mon, 07 Mar 2011 18:04:01 -0500") 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 Matt Lundin writes: > Matt Lundin writes: > >> I traced the problem to an extra forward-line added to >> org-footnote-goto-local-insertion-point with commit >> 145109dc4a6f161e4ad826bea9cc970363649280. >> >> 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.) >> > My apologies. Please disregard this patch. It does not fix the issue and > cause problems when creating footnotes. > > I'll take a closer look at the code when I get a chance. The following patch fixes the sorting bug. It also inserts a blank line above a new footnote definition, which is consistent with the spacing that results when sorting footnotes. --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index b6a9bca..f2b3489 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -314,7 +314,7 @@ or new, let the user edit the definition of the footnote." ;; Skip existing footnotes (while (re-search-forward "^[[:space:]]*\\[[^]]+\\] " nil t) (forward-line)) - (insert "[" label "] \n") + (insert "\n[" label "] \n") (goto-char (1- (point))) (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'."))) @@ -500,7 +500,7 @@ ENTRY is (fn-label num-mark definition)." (when (re-search-forward (format ".\\[%s[]:]" (regexp-quote (car entry))) nil t) (org-footnote-goto-local-insertion-point) - (insert (format "\n\n[%s] %s" (car entry) (nth 2 entry)))))) + (insert (format "\n[%s] %s\n" (car entry) (nth 2 entry)))))) (defun org-footnote-goto-local-insertion-point () "Find insertion point for footnote, just before next outline heading." --8<---------------cut here---------------end--------------->8--- Best, Matt