Looks like string-replace doesn't support that notation,
so both too aggressive and without sufficient control.
I've switched to replace-regexp-in-string which does
what we want.

Here's the updated patch.
From 12ca29965e867acd64fecaecd14f2f74e90d7e99 Mon Sep 17 00:00:00 2001
From: Tom Gillespie <tgb...@gmail.com>
Date: Sun, 4 Dec 2022 01:02:35 -0800
Subject: [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats
 refactor

* lisp/org-expiry.el (org-expiry-insert-created)
(org-expiry-insert-expiry): timestamp formats dropped delimiters so a
slight modification is required following org commit
e3a7c01874c9bb80e04ffa58c578619faf09e7f0, the change is made backward
compatible by removing < and > from the old timestamp format
---
 lisp/org-expiry.el | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lisp/org-expiry.el b/lisp/org-expiry.el
index 98ad58a..0462735 100644
--- a/lisp/org-expiry.el
+++ b/lisp/org-expiry.el
@@ -299,10 +299,13 @@ update the date."
       (setq d-hour (format-time-string "%H:%M" d-time))
       (setq timestr
 	    ;; two C-u prefixes will call org-read-date
-	    (if (equal arg '(16))
-		(concat "<" (org-read-date
-			     nil nil nil nil d-time d-hour) ">")
-	      (format-time-string (cdr org-time-stamp-formats))))
+            (concat "<"
+                    (if (equal arg '(16))
+                        (org-read-date nil nil nil nil d-time d-hour)
+                      (format-time-string
+                       (replace-regexp-in-string "\\(^<\\|>$\\)" ""
+                       (cdr org-time-stamp-formats))))
+                    ">"))
       ;; maybe transform to inactive timestamp
       (if org-expiry-inactive-timestamps
 	  (setq timestr (concat "[" (substring timestr 1 -1) "]")))
@@ -320,10 +323,13 @@ and insert today's date."
     (setq d-time (if d (org-time-string-to-time d)
 		   (current-time)))
     (setq d-hour (format-time-string "%H:%M" d-time))
-    (setq timestr (if today
-		      (format-time-string (cdr org-time-stamp-formats))
-		    (concat "<" (org-read-date
-				 nil nil nil nil d-time d-hour) ">")))
+    (setq timestr (concat "<"
+                          (if today
+                              (format-time-string
+                               (replace-regexp-in-string "\\(^<\\|>$\\)" ""
+                               (cdr org-time-stamp-formats)))
+                            (org-read-date nil nil nil nil d-time d-hour))
+                          ">"))
     ;; maybe transform to inactive timestamp
     (if org-expiry-inactive-timestamps
 	(setq timestr (concat "[" (substring timestr 1 -1) "]")))
-- 
2.37.4

Reply via email to