From 485cd21366b651093c9c9c75e7398d662c99e92f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 9 Apr 2022 00:17:09 -0700 Subject: [PATCH 1/7] Use unknown DST instead of standard time in timestamps * lisp/ol.el (org-store-link): Prefer plain (encode-time ...) to (apply 'encode-time ...), for speed. * lisp/org-macs.el (org-parse-time-string): Return unknown DST, not standard time. * lisp/org.el (org-read-date-analyze): Return a timestamp with a DST flag of -1 (unknown) rather than nil (standard time). Max Nikulin: A larger patch "Improve Org usage of timestamps" was suggested in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54764#10 Changes selected for this patch normalizes timestamp format: if it is a list than it should contain 9 elements to be compatible with Emacs-27 and Emacs-28 `encode-time' single argument, nil should not be used for DST field since it means standard time while actual value is unknown and should be guessed. Ignacio Casso reported a problem with agenda https://list.orgmode.org/PAXPR06MB7760238F410CBE3203F78EE0C61E9@PAXPR06MB7760.eurprd06.prod.outlook.com due to Emacs commit dd0727e1ec1 changing Org code. It was mostly reverted by 8ef37913d3 (bug#54731). Code in the Org repository did not have the bug, but it safer to add protection against similar refactoring. --- lisp/ol.el | 4 +--- lisp/org-macs.el | 2 +- lisp/org.el | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index d4bd0e40c..0de9c921b 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1618,9 +1618,7 @@ non-nil." (setq link (format-time-string (car org-time-stamp-formats) - (apply 'encode-time - (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd) - nil nil nil)))) + (encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)))) (org-link-store-props :type "calendar" :date cd))) ((eq major-mode 'w3-mode) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 8535bf2cd..241155064 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -1412,7 +1412,7 @@ This should be a lot faster than the `parse-time-string'." (string-to-number (match-string 4 s)) (string-to-number (match-string 3 s)) (string-to-number (match-string 2 s)) - nil nil nil)) + nil -1 nil)) (defun org-matcher-time (s) "Interpret a time comparison value S as a floating point time. diff --git a/lisp/org.el b/lisp/org.el index 1d5fc3903..165c83609 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13663,7 +13663,7 @@ user." (setq year (nth 5 org-defdecode)) (setq org-read-date-analyze-forced-year t)))) (setq org-read-date-analyze-futurep futurep) - (list second minute hour day month year))) + (list second minute hour day month year nil -1 nil))) (defvar parse-time-weekdays) (defun org-read-date-get-relative (s today default) -- 2.25.1