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: Re: Footnote sorting bug
Date: Mon, 07 Mar 2011 20:04:00 -0500	[thread overview]
Message-ID: <8762rul8xr.fsf@fastmail.fm> (raw)
In-Reply-To: <87mxl6sfby.fsf@fastmail.fm> (Matt Lundin's message of "Mon, 07 Mar 2011 18:04:01 -0500")

Matt Lundin <mdl@imapmail.org> writes:

> Matt Lundin <mdl@imapmail.org> 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

  reply	other threads:[~2011-03-08  1:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 19:06 Footnote sorting bug Matt Lundin
2011-03-07 23:04 ` Matt Lundin
2011-03-08  1:04   ` Matt Lundin [this message]
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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=8762rul8xr.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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