emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org 82a09ba0ae 2/2: org-macs.el: Fix template expansion


From: ELPA Syncer
Subject: [elpa] externals/org 82a09ba0ae 2/2: org-macs.el: Fix template expansion
Date: Sat, 30 Apr 2022 05:57:41 -0400 (EDT)

branch: externals/org
commit 82a09ba0ae4531e59e9234762b70d6f8500cedca
Author: Andrew Arensburger <arensb>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-macs.el: Fix template expansion
    
    * lisp/org-macs.el (org-fill-template): Fix a bug in template
    expansion: if one key is a substring of another key (like "noweb" and
    "noweb-ref", or "tangle" and "tangle-mode"), the second key wouldn't
    get expanded properly.  The problem was that keys were processed in
    order of increasing length; they are now sorted in order of descending
    length.
    
    TINYCHANGE
---
 lisp/org-macs.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index fa3d210e63..8535bf2cd6 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1139,7 +1139,10 @@ as-is if removal failed."
   "Find each %key of ALIST in TEMPLATE and replace it."
   (let ((case-fold-search nil))
     (dolist (entry (sort (copy-sequence alist)
-                         (lambda (a b) (< (length (car a)) (length (car b))))))
+                         ; Sort from longest key to shortest, so that
+                         ; "noweb-ref" and "tangle-mode" get processed
+                         ; before "noweb" and "tangle", respectively.
+                         (lambda (a b) (< (length (car b)) (length (car a))))))
       (setq template
            (replace-regexp-in-string
             (concat "%" (regexp-quote (car entry)))



reply via email to

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