>From ae1e4041f77d056649b8fa90d12e2cd1354b78f3 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yanta...@gmail.com>
Date: Mon, 15 Mar 2021 15:18:20 +0800
Subject: [PATCH] Allow multiple %(expression) instances in
 org-agenda-prefix-format

* lisp/org-agenda.el (org-compile-prefix-format): Use non-greedy match
for %(expression).

Previously, format like "%-12.12s%(expr1) %(expr2)" would not be
parsed correctly because of greedy "(.+)" regexp used to match the
expressions.
---
 lisp/org-agenda.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 50a9b3dbd..8bd328e6d 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6929,7 +6929,7 @@ and stored in the variable `org-prefix-format-compiled'."
 	    (t "  %-12:c%?-12t% s")))
 	(start 0)
 	varform vars var c f opt) ;; e
-    (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cltseib]\\|(.+)\\)"
+    (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cltseib]\\|(.+?)\\)"
 			 s start)
       (setq var (or (cdr (assoc (match-string 4 s)
 				'(("c" . category) ("t" . time) ("l" . level) ("s" . extra)
-- 
2.26.2


Reply via email to