emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tom Gillespie <tgbugs@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats
Date: Mon, 12 Dec 2022 17:23:02 -0800	[thread overview]
Message-ID: <CA+G3_PMfF24i+ZPsfRaopHaFFrKC7-cREGSmt0faqzciHoEciw@mail.gmail.com> (raw)
In-Reply-To: <87mt7thsdn.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 67 bytes --]

Here's the rebased patch. It should apply without issue. Best!
Tom

[-- Attachment #2: 0001-lisp-org-expiry.el-Account-for-org-time-stamp-format.patch --]
[-- Type: text/x-patch, Size: 2837 bytes --]

From 5247d2459800f82434f1bc3aeea136c18af7923c Mon Sep 17 00:00:00 2001
From: Tom Gillespie <tgbugs@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 | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/lisp/org-expiry.el b/lisp/org-expiry.el
index b359610..c3dad28 100644
--- a/lisp/org-expiry.el
+++ b/lisp/org-expiry.el
@@ -301,12 +301,17 @@ update the date."
 		     (current-time)))
       (setq d-hour (format-time-string "%H:%M" d-time))
       (setq timestr
-            (org-expiry-format-timestamp
-             ;; two C-u prefixes will call org-read-date
-	     (if (equal arg '(16))
-		 (org-read-date nil nil nil nil d-time d-hour)
-	       (format-time-string (cdr org-time-stamp-formats)))
-             org-expiry-inactive-timestamps))
+	    ;; two C-u prefixes will call org-read-date
+            (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) "]")))
       (save-excursion
 	(org-entry-put
 	 (point) org-expiry-created-property-name timestr)))))
@@ -321,11 +326,16 @@ 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 (org-expiry-format-timestamp
-                   (if today
-		       (format-time-string (cdr org-time-stamp-formats))
-		     (org-read-date nil nil nil nil d-time d-hour))
-                   org-expiry-inactive-timestamps))
+    (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) "]")))
 
     (save-excursion
       (org-entry-put
-- 
2.37.4


  reply	other threads:[~2022-12-13  1:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-04 19:08 [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats Tom Gillespie
2022-12-08 11:42 ` Ihor Radchenko
2022-12-10 21:00   ` Tom Gillespie
2022-12-11  9:21     ` Ihor Radchenko
2022-12-11 21:04       ` Tom Gillespie
2022-12-12  9:40         ` Ihor Radchenko
2022-12-13  1:23           ` Tom Gillespie [this message]
2022-12-13  8:59             ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+G3_PMfF24i+ZPsfRaopHaFFrKC7-cREGSmt0faqzciHoEciw@mail.gmail.com \
    --to=tgbugs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).