emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: TRS-80 <lists.trs-80@isnotmyreal.name>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-footnote: fix inserting new footnote mangling drawers (was: Re: Bug: inserting footnote when Footnotes heading has property drawer [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/user/.emacs.d/elpa/org-plus-contrib-20200309/)])
Date: Mon, 11 Jan 2021 00:57:09 GMT	[thread overview]
Message-ID: <87h7nop9y5.fsf@kyleam.com> (raw)
In-Reply-To: <e46f88534b9ccc889f7517638aeaf4ec@isnotmyreal.name>

Thanks for the initial report and the patch.

TRS-80 writes:

> Attached please find a very simple (one line) patch that I believe
> should fix this issue.
>
> This patch is of course based on latest git (not my personal outdated
> version) and also maint branch.  I think I've got that right?

Looks good to me.

> Subject: [PATCH] org-footnote: fix inserting new footnote mangling drawers

convention nit: s/fix/Fix/ (no need to resend)

> * 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
> ---
>  lisp/org-footnote.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I'm planning to squash the following test in when applying.  Look okay
to you?


diff --git a/testing/lisp/test-org-footnote.el b/testing/lisp/test-org-footnote.el
index eca24d315..50a430785 100644
--- a/testing/lisp/test-org-footnote.el
+++ b/testing/lisp/test-org-footnote.el
@@ -138,7 +138,20 @@ (ert-deftest test-org-footnote/new ()
 	  (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."


  reply	other threads:[~2021-01-11  0:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03 21:27 Bug: inserting footnote when Footnotes heading has property drawer [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/user/.emacs.d/elpa/org-plus-contrib-20200309/)] TRS-80
2021-01-09 17:12 ` [PATCH] org-footnote: fix inserting new footnote mangling drawers (was: Re: Bug: inserting footnote when Footnotes heading has property drawer [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/user/.emacs.d/elpa/org-plus-contrib-20200309/)]) TRS-80
2021-01-11  0:57   ` Kyle Meyer [this message]
2021-01-12 19:46     ` TRS-80
2021-01-13  3:47       ` Kyle Meyer
2021-01-14  5:23         ` Kyle Meyer

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=87h7nop9y5.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=lists.trs-80@isnotmyreal.name \
    --subject='Re: [PATCH] org-footnote: fix inserting new footnote mangling drawers (was: Re: Bug: inserting footnote when Footnotes heading has property drawer [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/user/.emacs.d/elpa/org-plus-contrib-20200309/)])' \
    /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

Code repositories for project(s) associated with this 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).