From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thomas Fitzsimmons Newsgroups: gmane.emacs.bugs Subject: bug#68653: Excorporate: generate better org timestamps Date: Wed, 14 Feb 2024 22:38:44 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32907"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68653@debbugs.gnu.org To: Benjamin Leis Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 15 04:40:13 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1raSbc-0008L5-My for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Feb 2024 04:40:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raSbB-0005as-Mr; Wed, 14 Feb 2024 22:39:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raSbA-0005ac-E7 for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 22:39:44 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raSbA-0003jx-4z for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 22:39:44 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raSbS-0006dA-Av for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 22:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thomas Fitzsimmons Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Feb 2024 03:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68653 X-GNU-PR-Package: emacs Original-Received: via spool by 68653-submit@debbugs.gnu.org id=B68653.170796835225391 (code B ref 68653); Thu, 15 Feb 2024 03:40:02 +0000 Original-Received: (at 68653) by debbugs.gnu.org; 15 Feb 2024 03:39:12 +0000 Original-Received: from localhost ([127.0.0.1]:53708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raSae-0006bQ-4H for submit@debbugs.gnu.org; Wed, 14 Feb 2024 22:39:12 -0500 Original-Received: from mail.fitzsim.org ([69.165.165.189]:51238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raSab-0006bD-W7 for 68653@debbugs.gnu.org; Wed, 14 Feb 2024 22:39:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fitzsim.org ; s=20220430; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xMEe0oj+FZTrdVZY25YFOEJWZjRXlS9AIj54cvLsn+s=; b=HTZil+0S43lhWNDbQCekDdMQgP adLDRH2wwh3uMnWI2JteXiepF30PmTxJMgSEFwQ7mfgz4CuNPTpUAUpRI+GTfSnhsWrQL1FhCNS8W gE2iwJyJ8FGWG9D0CTOjHOb8urJMvjqY+AgZhqyXmk/TQmsFD/4quARgr0tst+vrm7hAgGwrPNXWZ fqwW9qD9SsZLTp02kYFzk1jKtX2n5IiFKInqwfO2qw3ALrEuF6kd37/Lyw9TPVD5EcC6IfiKGA0Qd G9SbGjAQVFHt9OVlVdb8hOxH3R+vIIfHaliYnrtfgAgW/9xmWg8VjGPi0ki46d+qTha01znmb6aJl HddITvSg==; Original-Received: from [192.168.1.1] (helo=localhost.localdomain) by mail.fitzsim.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1raSaD-001Mil-5C; Wed, 14 Feb 2024 22:38:45 -0500 In-Reply-To: (Benjamin Leis's message of "Sun, 21 Jan 2024 11:52:09 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280035 Archived-At: Hi Benjamin, Thank you for the patch. From my testing, when org-schedule is passed a start and end date separated by "--", it only includes the start date in the range. Therefore, your patch as-is would be a regression because it would omit the end date. Unless I am missing something, an Org date range cannot express an end timestamp on a different day. I guess that is why I originally used the -- notation, and appended -- after the org-schedule call. Can you test the attached amended patch (whitespace-only changes omitted) and confirm it works as you expect for same-day events, while preserving the existing behaviour of end timestamps of multi-day events? (A more ambitious plan would be to add support to Org for multi-day ranges, then have Excorporate use that new format instead, but no users have complained about -- so far, so I am fine continuing with that, and adding the hour ranges as you suggest.) Thank you, Thomas 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 @@ defun exco-org-insert-meeting-headline "TODO" "DONE"))) (insert (format "** %s %s\n" keyword subject)) + ;; 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)) + (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")))