From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uM+nOWLk+V8uMgAA0tVLHw (envelope-from ) for ; Sat, 09 Jan 2021 17:14:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uOBUNWLk+V+cMQAAbx9fmQ (envelope-from ) for ; Sat, 09 Jan 2021 17:14:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 501F29403D5 for ; Sat, 9 Jan 2021 17:14:10 +0000 (UTC) Received: from localhost ([::1]:37350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyHoW-0002uz-AW for larch@yhetil.org; Sat, 09 Jan 2021 12:14:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyHo2-0002ur-RP for emacs-orgmode@gnu.org; Sat, 09 Jan 2021 12:13:38 -0500 Received: from server173-4.web-hosting.com ([68.65.122.210]:40940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyHnz-0005J0-U2 for emacs-orgmode@gnu.org; Sat, 09 Jan 2021 12:13:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=isnotmyreal.name; s=default; h=Content-Type:Message-ID:References: In-Reply-To:Subject:To:From:Date:MIME-Version:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yI8UxHwD9CbhL0slo4CDfJ+f5VIuk7hcpSsFiluMagY=; b=ibDW6KuillDXOX/usy5DwllrW pBK7T4zy7s8YOY8diyg7KMqMZQitziy5lWFHn1+lT/Bx+PGPQDvM1AQsCuQDkAe+Hf9agMVKYP7PV UjxriNmP/wgdtSoCoHCYNCjRV7vtFqfIWngimDEmRo3ZoWPLOkw4tCL+wXWb2wiAplew8rcDKBuuh /AERD1RUnyZglKjUQBn66V8nxbsMDx91qgN3pxozJnIKct69rMf86Z5b/Jwck+GZmU0wFS085ruG/ 16tLosHkXjT6PO8ySjSFQKfg0FJKHiOMR1xRFqXokFK9wqlyCsMtwUa3ENMUIRT995HCeTZ9AS0uv 4Vey+h1ZA==; Received: from [::1] (port=42288 helo=server173.web-hosting.com) by server173.web-hosting.com with esmtpa (Exim 4.93) (envelope-from ) id 1kyHnD-003bZZ-R6 for emacs-orgmode@gnu.org; Sat, 09 Jan 2021 12:12:52 -0500 MIME-Version: 1.0 Date: Sat, 09 Jan 2021 12:12:47 -0500 From: TRS-80 To: emacs-orgmode@gnu.org Subject: [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/)]) In-Reply-To: <1e98d0e48139cfb9cc98460dbf7ffccd@isnotmyreal.name> References: <1e98d0e48139cfb9cc98460dbf7ffccd@isnotmyreal.name> Message-ID: X-Sender: lists.trs-80@isnotmyreal.name User-Agent: Roundcube Webmail/1.3.15 Content-Type: multipart/mixed; boundary="=_ed6543738e664baeb1e5bc755adf36d9" X-OutGoing-Spam-Status: No, score=-0.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server173.web-hosting.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - isnotmyreal.name X-Get-Message-Sender-Via: server173.web-hosting.com: authenticated_id: lists.trs-80@isnotmyreal.name X-Authenticated-Sender: server173.web-hosting.com: lists.trs-80@isnotmyreal.name X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched Received-SPF: pass client-ip=68.65.122.210; envelope-from=lists.trs-80@isnotmyreal.name; helo=server173-4.web-hosting.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 1.49 Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=isnotmyreal.name header.s=default header.b=ibDW6Kui; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 501F29403D5 X-Spam-Score: 1.49 X-Migadu-Scanner: scn1.migadu.com X-TUID: j5fAPrn2ul+W --=_ed6543738e664baeb1e5bc755adf36d9 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 2021-01-03 16:27, TRS-80 wrote: > Hello! > > I seem to have come across a bug today in org-footnote. > > I had just learned about the variable org-footnote-auto-adjust and set > it to t. Then I tried to test it by invoking org-footnote-new in my > Org file in between existing footnotes 2 and 3. > > N.B., my Footnotes heading, prior to doing above also had a CUSTOM_ID > property set: > > #+begin_src org > ,** Footnotes > :PROPERTIES: > :CUSTOM_ID: footnotes > :END: > > [fn:1] original footnote 1 > > [fn:2] original footnote 2 > > [fn:3] original footnote 3 > > [fn:4] original footnote 4 > > #+end_src > > The new footnote seems to get inserted into correct place, however > there > appears to be a problem if there is a property drawer: > > #+begin_src org > ,** Footnotes > > [fn:1] original footnote 1 > > [fn:2] original footnote 2 > > [fn:3] new footnote > :PROPERTIES: > :CUSTOM_ID: footnotes > :END: > > [fn:4] original footnote 3 > > [fn:5] original footnote 4 > > #+end_src > > Since I was just studying the org-footnote code anyway, I will attempt > to further diagnose the issue, and perhaps even send a patch. > > As I was filling out bug report I realized I am on slightly dated > version of Orgmode. So I went ahead and cloned latest version and did > a > diff on org-footnote.el between my affected version here locally and > latest, and the only change I saw was the copyright date. > > So with that out of the way, I will start digging and see what I can > come up with. > > Cheers, > TRS-80 > > > Emacs : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version > 3.24.20) > of 2020-05-16, modified by Debian > Package: Org mode version 9.3.6 (9.3.6-23-g01ee25-elpaplus @ > /home/user/.emacs.d/elpa/org-plus-contrib-20200309/) 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? However as it will be my first patch to Orgmode, any feedback would be welcomed. Cheers, TRS-80 --=_ed6543738e664baeb1e5bc755adf36d9 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-org-footnote-fix-inserting-new-footnote-mangling-dra.patch Content-Disposition: attachment; filename=0001-org-footnote-fix-inserting-new-footnote-mangling-dra.patch; size=1077 RnJvbSBjZjcxMTFhODc2NDUyNjJjNjgyMTRhMDNjYTg4ZjcyYmIwNzEwMDQ5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUUlMtOD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