branch: externals/excorporate
commit d01881c8c420a308e388ab394e5d45ba894907ef
Author: Benjamin Leis <benle...@gmail.com>
Commit: Thomas Fitzsimmons <fitz...@fitzsim.org>

    Shorten same-day time ranges
    
    * excorporate-org.el (exco-org-insert-meeting-headline): Show a
    time period for meetings whose start and end times occur on the
    same day.  (Bug#68653)
    
    Co-authored-by: Thomas Fitzsimmons <fitz...@fitzsim.org>
---
 excorporate-org.el | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/excorporate-org.el b/excorporate-org.el
index 74dbe9d111..f6bdc10fe3 100644
--- a/excorporate-org.el
+++ b/excorporate-org.el
@@ -251,11 +251,19 @@ identifier."
                      "TODO"
                    "DONE")))
     (insert (format "** %s %s\n" keyword subject))
-    (org-schedule nil (format-time-string "<%Y-%m-%d %a %H:%M>"
-                                         start-time))
-    (forward-line -1)
-    (end-of-line)
-    (insert  "--" (format-time-string "<%Y-%m-%d %a %H:%M>" end-time))
+    ;; If the meeting times are on the same day use a time period
+    ;; otherwise use a range of days.
+    (if (= (time-to-day-in-year start-time) (time-to-day-in-year end-time))
+       (org-schedule
+        nil (format "<%s-%s>"
+                    (format-time-string "%Y-%m-%d %a %H:%M" start-time)
+                    (format-time-string "%H:%M" end-time)))
+      (progn
+        (org-schedule nil (format-time-string "<%Y-%m-%d %a %H:%M>"
+                                             start-time))
+        (forward-line -1)
+        (end-of-line)
+        (insert  "--" (format-time-string "<%Y-%m-%d %a %H:%M>" end-time))))
     (forward-line)
     (org-set-property "Identifier" (format "%S" item-identifier))
     (org-insert-time-stamp (current-time) t t "+ Retrieved " "\n")))

Reply via email to