emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Footnote sorting bug
Date: Mon, 07 Mar 2011 14:06:40 -0500	[thread overview]
Message-ID: <87y64qsqbj.fsf@fastmail.fm> (raw)

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---


             reply	other threads:[~2011-03-07 19:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 19:06 Matt Lundin [this message]
2011-03-07 23:04 ` Footnote sorting bug Matt Lundin
2011-03-08  1:04   ` Matt Lundin
2011-03-09 10:46     ` [Accepted] [O] " Bastien Guerry
2011-03-09 10:47     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y64qsqbj.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).