Explorar el Código

Footnotes: Fix bug with insertion at end of buffer

With the "* Footnotes" heading as last line in the buffer, footnote
insertion did not position new definitions correctly.  This commit
fixes the problem.

Reported by Matt Lundin.
Carsten Dominik hace 16 años
padre
commit
c0100ad2b1
Se han modificado 2 ficheros con 9 adiciones y 1 borrados
  1. 7 0
      lisp/ChangeLog
  2. 2 1
      lisp/org-footnote.el

+ 7 - 0
lisp/ChangeLog

@@ -1,3 +1,10 @@
+2009-01-05  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-footnote.el (org-footnote-create-definition)
+	(org-footnote-goto-local-insertion-point): Make footnote insertion
+	work correctly when the "Footnotes" headline is the last line in
+	the buffer.
+
 2009-01-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-w3m.el (org-w3m): New customization group.

+ 2 - 1
lisp/org-footnote.el

@@ -267,7 +267,7 @@ or new, let the user edit the definition of the footnote."
 		    (and (progn (widen) t)
 			 (re-search-forward re nil t)))
 	  (goto-char (point-max))
-	  (insert "\n\n* " org-footnote-section)))
+	  (insert "\n\n* " org-footnote-section "\n")))
       ;; Now go to the end of this entry and insert there.
       (org-footnote-goto-local-insertion-point))
      (t
@@ -452,6 +452,7 @@ ENTRY is (fn-label num-mark definition)."
 (defun org-footnote-goto-local-insertion-point ()
   "Find insertion point for footnote, just before next outline heading."
   (outline-next-heading)
+  (or (bolp) (newline))
   (beginning-of-line 0)
   (while (and (not (bobp)) (= (char-after) ?#))
     (beginning-of-line 0))