emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Allow multiple %(expression) instances in org-agenda-prefix-format
@ 2021-03-15  7:22 Ihor Radchenko
  2021-04-26  8:06 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2021-03-15  7:22 UTC (permalink / raw)
  To: emacs-orgmode

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Allow-multiple-expression-instances-in-org-agenda-pr.patch --]
[-- Type: text/x-diff, Size: 1193 bytes --]

From ae1e4041f77d056649b8fa90d12e2cd1354b78f3 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yantar92@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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Allow multiple %(expression) instances in org-agenda-prefix-format
  2021-03-15  7:22 [PATCH] Allow multiple %(expression) instances in org-agenda-prefix-format Ihor Radchenko
@ 2021-04-26  8:06 ` Bastien
  2021-04-29 14:17   ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2021-04-26  8:06 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Applied as 0260d2fcf, thanks!

Ihor Radchenko <yantar92@gmail.com> writes:

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Allow multiple %(expression) instances in org-agenda-prefix-format
  2021-04-26  8:06 ` Bastien
@ 2021-04-29 14:17   ` Ihor Radchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2021-04-29 14:17 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@gnu.org> writes:

> Applied as 0260d2fcf, thanks!

Looking at the patch again, I notice that it will break code like
"%((this (has (many parenthesis))))". Though I have no clue how to match
balanced parenthesis using Elisp regexps.

Best,
Ihor


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-29 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-15  7:22 [PATCH] Allow multiple %(expression) instances in org-agenda-prefix-format Ihor Radchenko
2021-04-26  8:06 ` Bastien
2021-04-29 14:17   ` Ihor Radchenko

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