org-footnote: Fix bug related to sorting and folded view

* lisp/org-footnote.el (org-footnote-delete-definitions): Remove blank
  lines before the footnote definition instead of removing those after
  it.
* testing/lisp/test-org-footnote.el: Adapt tests.
This commit is contained in:
Nicolas Goaziou 2012-04-08 12:01:57 +02:00
parent 2ff3da0f1a
commit d6faea24d4
2 changed files with 5 additions and 7 deletions

View File

@ -864,11 +864,11 @@ Return the number of footnotes removed."
(while (re-search-forward def-re nil t)
(let ((full-def (org-footnote-at-definition-p)))
(when full-def
;; Remove the footnote, and all blank lines after it.
(goto-char (nth 2 full-def))
(org-skip-whitespace)
(unless (eobp) (beginning-of-line))
(delete-region (nth 1 full-def) (point))
;; Remove the footnote, and all blank lines before it.
(goto-char (nth 1 full-def))
(skip-chars-backward " \r\t\n")
(unless (bolp) (forward-line))
(delete-region (point) (nth 2 full-def))
(incf ndef))))
ndef)))

View File

@ -109,7 +109,6 @@ Body[1]
\[4] Inline
\[5] Anonymous
")))
;; 2.2. Put each footnote definition at the end of the section
;; containing its first reference.
@ -256,7 +255,6 @@ Signature")))))
\[fn:2] B
\[fn:label] C
")))))