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

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

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


From: ELPA Syncer
Subject: [elpa] externals-release/org 15badb3: agenda: Fix org-duration-to-minutes error (take 4)
Date: Fri, 18 Jun 2021 08:57:17 -0400 (EDT)

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

    agenda: Fix org-duration-to-minutes error (take 4)
    
    * lisp/org-agenda.el (org-get-time-of-day): Fix regexp.
    
    This is a followup to aba1f20661cfa69e84caf59336f2d40e80aee27c.
---
 lisp/org-agenda.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index c287eb5..0ad4105 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6907,14 +6907,15 @@ where H:MM is the duration above midnight."
   (let ((case-fold-search t)
         (time-regexp
          (rx word-start
-             (group (opt (any "012")) digit)        ;group 1: hours
-             (opt ":" (group (any "012345") digit)) ;group 2: minutes
-             (opt (group (or "am" "pm")))           ;group 3: am/pm
+             (group (opt (any "012")) digit)           ;group 1: hours
+             (or (and ":" (group (any "012345") digit) ;group 2: minutes
+                      (opt (group (or "am" "pm"))))    ;group 3: am/pm
+                 ;; Special "HHam/pm" case.
+                 (group-n 3 (or "am" "pm")))
              word-end)))
     (save-match-data
       (when (and (not (eq 'org-link (get-text-property 1 'face s)))
-                 (string-match time-regexp s)
-                 (or (match-end 2) (match-end 3)))
+                 (string-match time-regexp s))
         (let ((hours
                (let* ((ampm (and (match-end 3) (downcase (match-string 3 s))))
                       (am-p (equal ampm "am")))
@@ -6923,7 +6924,9 @@ where H:MM is the duration above midnight."
                    (12 (if am-p 0 12))
                    (h (+ h (if am-p 0 12))))))
               (minutes
-               (if (match-end 2) (string-to-number (match-string 2 s)) 0)))
+               (if (match-end 2)
+                   (string-to-number (match-string 2 s))
+                 0)))
           (pcase string
             (`nil (+ minutes (* hours 100)))
             ((and `overtime



reply via email to

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