Преглед на файлове

org-footnote: Fix inserting new footnote mangling drawers

* org-footnote.el (org-footnote-create-definition): Replace
  `forward-line' with `org-end-of-meta-data' to skip over any
  properties and/or drawers that may be present on the
  `org-footnote-section' heading (default "Footnotes").

TINYCHANGE
TRS-80 преди 4 години
родител
ревизия
1806abdc39
променени са 2 файла, в които са добавени 15 реда и са изтрити 2 реда
  1. 1 1
      lisp/org-footnote.el
  2. 14 1
      testing/lisp/test-org-footnote.el

+ 1 - 1
lisp/org-footnote.el

@@ -704,7 +704,7 @@ function doesn't move point."
 	   (concat "^\\*+[ \t]+" (regexp-quote org-footnote-section) "[ \t]*$")
 	   nil t))
 	(goto-char (match-end 0))
-	(forward-line)
+        (org-end-of-meta-data t)
 	(unless (bolp) (insert "\n")))
        (t (org-footnote--clear-footnote-section)))
       (when (zerop (org-back-over-empty-lines)) (insert "\n"))

+ 14 - 1
testing/lisp/test-org-footnote.el

@@ -138,7 +138,20 @@
 	  (org-test-with-temp-text
 	      "Paragraph<point>\n# Local Variables:\n# foo: t\n# End:"
 	    (let ((org-footnote-section "Footnotes")) (org-footnote-new))
-	    (buffer-string)))))
+	    (buffer-string))))
+  (should
+   (equal "Para[fn:1]
+* Footnotes
+:properties:
+:custom_id: id
+:end:
+
+\[fn:1]"
+          (org-test-with-temp-text
+              "Para<point>\n* Footnotes\n:properties:\n:custom_id: id\n:end:"
+            (let ((org-footnote-section "Footnotes"))
+              (org-footnote-new))
+            (org-trim (buffer-string))))))
 
 (ert-deftest test-org-footnote/delete ()
   "Test `org-footnote-delete' specifications."