emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch: bug in template expansion in org-fill-template


From: Andrew Arensburger
Subject: Patch: bug in template expansion in org-fill-template
Date: Thu, 7 Apr 2022 00:08:56 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

There appears to be a bug in `org-fill-template' (in lisp/org-macs.el): keys to be expanded are sorted by increasing length, so that "noweb" is processed before "noweb-ref". As a result, if a template includes "%noweb-ref", `org-fill-template' will expand it as "%{noweb}-ref" rather than "%{noweb-ref}".

As far as I can tell, this bug has existed since `org-fill-template' was added, in e8ef16306ca56af2dceb9e2be0b57c930e9b5584 . I tried to trace it as back as I could, to see whether there was a good reason for sorting keys this way, but couldn't find one.

I'm including a patch with a test to find buggy behavior, and another to fix it.

Attachment: 0001-test-org-macs.el-Add-test-for-template-expansion-bug.patch
Description: Text Data

Attachment: 0002-org-macs.el-Fix-template-expansion.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]