emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals-release/org c26f8d2: agenda: Fix org-duration-to-minute


From: ELPA Syncer
Subject: [elpa] externals-release/org c26f8d2: agenda: Fix org-duration-to-minutes error (take 2)
Date: Tue, 11 May 2021 03:57:15 -0400 (EDT)

branch: externals-release/org
commit c26f8d2cc508fdee5ec8d9b48d7391a180d6298d
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>

    agenda: Fix org-duration-to-minutes error (take 2)
    
    * lisp/org.el (org-stamp-time-of-day-regexp): Limit match group 2 to
    first time.
    * lisp/org-agenda.el (org-agenda-format-item): Compute duration before
    formatting time with `org-get-time-of-day'.
---
 lisp/org-agenda.el | 11 ++++-------
 lisp/org.el        |  2 +-
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index b91bf3a..205225a 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6656,10 +6656,6 @@ Any match of REMOVE-RE will be removed from TXT."
                           (= (match-beginning 0) 0)
                         t))
              (setq txt (replace-match "" nil nil txt))))
-         ;; Normalize the time(s) to 24 hour
-         (when s1 (setq s1 (org-get-time-of-day s1 'string t)))
-         (when s2 (setq s2 (org-get-time-of-day s2 'string t)))
-
          ;; Try to set s2 if s1 and
          ;; `org-agenda-default-appointment-duration' are set
          (when (and s1 (not s2) org-agenda-default-appointment-duration)
@@ -6668,12 +6664,13 @@ Any match of REMOVE-RE will be removed from TXT."
                   (+ (org-duration-to-minutes s1 t)
                      org-agenda-default-appointment-duration)
                   nil t)))
-
          ;; Compute the duration
          (when s2
            (setq duration (- (org-duration-to-minutes s2)
-                             (org-duration-to-minutes s1)))))
-
+                             (org-duration-to-minutes s1))))
+          ;; Normalize the time(s) to 24 hour
+         (when s1 (setq s1 (org-get-time-of-day s1 'string t)))
+         (when s2 (setq s2 (org-get-time-of-day s2 'string t))))
        (when (string-match org-tag-group-re txt)
          ;; Tags are in the string
          (if (or (eq org-agenda-remove-tags t)
diff --git a/lisp/org.el b/lisp/org.el
index 6dbf33a..268ce74 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4106,7 +4106,7 @@ groups carry important information:
 (defconst org-stamp-time-of-day-regexp
   (concat
    "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)"
-   "\\([012][0-9]:[0-5][0-9]\\(-\\([012][0-9]:[0-5][0-9]\\)\\)?[^\n\r>]*?\\)>"
+   "\\([012][0-9]:[0-5][0-9]\\)\\(-\\([012][0-9]:[0-5][0-9]\\)\\)?[^\n\r>]*?>"
    "\\(--?"
    "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?")
   "Regular expression to match a timestamp time or time range.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]