* Does :block field of clocktable respect org-extend-today-until? @ 2018-04-17 5:51 Robert Irelan 2018-04-17 12:54 ` Nicolas Goaziou 0 siblings, 1 reply; 11+ messages in thread From: Robert Irelan @ 2018-04-17 5:51 UTC (permalink / raw) To: Org-mode Testing it just now, it appears that it doesn't - the clock table excludes times after midnight but before org-extend-today-until. I'll probably work on fixing this unless someone believes that the current version of org-mode is expected to respect org-extend-today-until. org-version gives: Org mode version 9.1.9 (9.1.9-8-gf05c2e-elpaplus) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-04-17 5:51 Does :block field of clocktable respect org-extend-today-until? Robert Irelan @ 2018-04-17 12:54 ` Nicolas Goaziou 2018-05-01 0:30 ` Robert Irelan 0 siblings, 1 reply; 11+ messages in thread From: Nicolas Goaziou @ 2018-04-17 12:54 UTC (permalink / raw) To: Robert Irelan; +Cc: Org-mode Hello, Robert Irelan <rirelan@gmail.com> writes: > Testing it just now, it appears that it doesn't - the clock table excludes > times after midnight but before org-extend-today-until. I'll probably work > on fixing this unless someone believes that the current version of org-mode > is expected to respect org-extend-today-until. org-version gives: > Org mode version 9.1.9 (9.1.9-8-gf05c2e-elpaplus) As its docstring states: IMPORTANT: This is a feature whose implementation is and likely will remain incomplete. IOW, nothing in Org is really expected to respect `org-extend-today-until'. Patches welcome, of course. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-04-17 12:54 ` Nicolas Goaziou @ 2018-05-01 0:30 ` Robert Irelan 2018-05-01 8:11 ` Bastien 0 siblings, 1 reply; 11+ messages in thread From: Robert Irelan @ 2018-05-01 0:30 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Org-mode I have a patch to fix this in https://github.com/telotortium/org-mode (branch org-clock-table-extend-today-until-block). I've submitted a copyright assignment with the FSF. On Tue, Apr 17, 2018 at 5:54 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote: > Hello, > Robert Irelan <rirelan@gmail.com> writes: > > Testing it just now, it appears that it doesn't - the clock table excludes > > times after midnight but before org-extend-today-until. I'll probably work > > on fixing this unless someone believes that the current version of org-mode > > is expected to respect org-extend-today-until. org-version gives: > > Org mode version 9.1.9 (9.1.9-8-gf05c2e-elpaplus) > As its docstring states: > IMPORTANT: This is a feature whose implementation is and likely will > remain incomplete. > IOW, nothing in Org is really expected to respect > `org-extend-today-until'. Patches welcome, of course. > Regards, > -- > Nicolas Goaziou -- Robert Irelan rirelan@gmail.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-05-01 0:30 ` Robert Irelan @ 2018-05-01 8:11 ` Bastien 2018-05-01 19:40 ` Robert Irelan 0 siblings, 1 reply; 11+ messages in thread From: Bastien @ 2018-05-01 8:11 UTC (permalink / raw) To: Robert Irelan; +Cc: Org-mode, Nicolas Goaziou Hi Robert, Robert Irelan <rirelan@gmail.com> writes: > I have a patch to fix this in https://github.com/telotortium/org-mode > (branch org-clock-table-extend-today-until-block). I've submitted a > copyright assignment with the FSF. I confirm your copyright assignment is okay. Can you send a patch against Org's current master branch? Thanks! -- Bastien ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-05-01 8:11 ` Bastien @ 2018-05-01 19:40 ` Robert Irelan 2018-05-07 17:43 ` Robert Irelan 0 siblings, 1 reply; 11+ messages in thread From: Robert Irelan @ 2018-05-01 19:40 UTC (permalink / raw) To: bzg; +Cc: Org-mode, Nicolas Goaziou I've updated my repo at https://github.com/telotortium/org-mode (branch org-clock-table-extend-today-until-block). (I know I cloned it from an older org-mode repo on Github, but I've updated it so that my branch is rebased onto the current master.) I hope that'll work. On Tue, May 1, 2018 at 1:11 AM Bastien <bzg@gnu.org> wrote: > Hi Robert, > Robert Irelan <rirelan@gmail.com> writes: > > I have a patch to fix this in https://github.com/telotortium/org-mode > > (branch org-clock-table-extend-today-until-block). I've submitted a > > copyright assignment with the FSF. > I confirm your copyright assignment is okay. > Can you send a patch against Org's current master branch? > Thanks! > -- > Bastien -- Robert Irelan rirelan@gmail.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-05-01 19:40 ` Robert Irelan @ 2018-05-07 17:43 ` Robert Irelan 2018-05-07 18:05 ` Nicolas Goaziou 0 siblings, 1 reply; 11+ messages in thread From: Robert Irelan @ 2018-05-07 17:43 UTC (permalink / raw) To: bzg; +Cc: Org-mode, Nicolas Goaziou Hi, is there anything else I should do on this patch? On Tue, May 1, 2018 at 12:40 PM Robert Irelan <rirelan@gmail.com> wrote: > I've updated my repo at https://github.com/telotortium/org-mode (branch > org-clock-table-extend-today-until-block). (I know I cloned it from an older > org-mode repo on Github, but I've updated it so that my branch is rebased > onto > the current master.) I hope that'll work. > On Tue, May 1, 2018 at 1:11 AM Bastien <bzg@gnu.org> wrote: > > Hi Robert, > > Robert Irelan <rirelan@gmail.com> writes: > > > I have a patch to fix this in https://github.com/telotortium/org-mode > > > (branch org-clock-table-extend-today-until-block). I've submitted a > > > copyright assignment with the FSF. > > I confirm your copyright assignment is okay. > > Can you send a patch against Org's current master branch? > > Thanks! > > -- > > Bastien > -- > Robert Irelan > rirelan@gmail.com -- Robert Irelan rirelan@gmail.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-05-07 17:43 ` Robert Irelan @ 2018-05-07 18:05 ` Nicolas Goaziou 2018-05-07 18:23 ` Robert Irelan 0 siblings, 1 reply; 11+ messages in thread From: Nicolas Goaziou @ 2018-05-07 18:05 UTC (permalink / raw) To: Robert Irelan; +Cc: bzg, Org-mode Hello, Robert Irelan <rirelan@gmail.com> writes: > Hi, is there anything else I should do on this patch? Would you mind sending it to the ML? It easier, at least for me, to review or apply. Thank you. Regards, -- Nicolas Goaziou 0x80A93738 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-05-07 18:05 ` Nicolas Goaziou @ 2018-05-07 18:23 ` Robert Irelan 2018-05-07 20:38 ` Nicolas Goaziou 0 siblings, 1 reply; 11+ messages in thread From: Robert Irelan @ 2018-05-07 18:23 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: bzg, Org-mode [-- Attachment #1: Type: text/plain, Size: 490 bytes --] I've rebased against latest master and attached the patch. On Mon, May 7, 2018 at 11:05 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote: > Hello, > Robert Irelan <rirelan@gmail.com> writes: > > Hi, is there anything else I should do on this patch? > Would you mind sending it to the ML? It easier, at least for me, to > review or apply. > Thank you. > Regards, > -- > Nicolas Goaziou 0x80A93738 -- Robert Irelan rirelan@gmail.com [-- Attachment #2: 0001-Make-org-extend-today-until-work-for-clocktable-bloc.patch --] [-- Type: text/x-patch, Size: 2910 bytes --] From 8b679dbd5a308561209c142bf806d13e2ee0ec10 Mon Sep 17 00:00:00 2001 From: Robert Irelan <rmirelan@google.com> Date: Mon, 30 Apr 2018 17:18:16 -0700 Subject: [PATCH] Make org-extend-today-until work for clocktable block org-clock: Properly handle `org-extend-today-until' in clock tables * lisp/org-clock.el (org-clock-special-range): Handle non-default `org-extend-today-until' when generating a clock table with the `:block` directive. Reported-by: Robert Irelan <rirelan@gmail.com> <http://lists.gnu.org/archive/html/emacs-orgmode/2018-04/msg00294.html> --- lisp/org-clock.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index d727fa150..5eaff8c8a 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -2201,13 +2201,17 @@ have priority." (`lastq (setq key 'quarter shift -1)))) ;; Prepare start and end times depending on KEY's type. (pcase key - ((or `day `today) (setq m 0 h 0 h1 24 d (+ d shift))) + ((or `day `today) (setq m 0 + h org-extend-today-until + h1 (+ 24 org-extend-today-until) + d (+ d shift))) ((or `week `thisweek) (let* ((ws (or wstart 1)) (diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws))))) - (setq m 0 h 0 d (- d diff) d1 (+ 7 d)))) + (setq m 0 h org-extend-today-until d (- d diff) d1 (+ 7 d)))) ((or `month `thismonth) - (setq h 0 m 0 d (or mstart 1) month (+ month shift) month1 (1+ month))) + (setq h org-extend-today-until m 0 d (or mstart 1) + month (+ month shift) month1 (1+ month))) ((or `quarter `thisq) ;; Compute if this shift remains in this year. If not, compute ;; how many years and quarters we have to shift (via floor*) and @@ -2225,14 +2229,16 @@ have priority." (setq shiftedy (- y (+ 1 (nth 0 tmp))) shiftedm (- 13 (* 3 (nth 1 tmp))) shiftedq (- 5 (nth 1 tmp))))) - (setq m 0 h 0 d 1 month shiftedm month1 (+ 3 shiftedm) y shiftedy)) + (setq m 0 h org-extend-today-until d 1 + month shiftedm month1 (+ 3 shiftedm) y shiftedy)) ((> (+ q shift) 0) ; Shift is within this year. (setq shiftedq (+ q shift)) (setq shiftedy y) (let ((qshift (* 3 (1- (+ q shift))))) - (setq m 0 h 0 d 1 month (+ 1 qshift) month1 (+ 4 qshift)))))) + (setq m 0 h org-extend-today-until d 1 + month (+ 1 qshift) month1 (+ 4 qshift)))))) ((or `year `thisyear) - (setq m 0 h 0 d 1 month 1 y (+ y shift) y1 (1+ y))) + (setq m 0 h org-extend-today-until d 1 month 1 y (+ y shift) y1 (1+ y))) ((or `interactive `untilnow)) ; Special cases, ignore them. (_ (user-error "No such time block %s" key))) ;; Format start and end times according to AS-STRINGS. -- 2.17.0.441.gb46fe60e1d-goog ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-05-07 18:23 ` Robert Irelan @ 2018-05-07 20:38 ` Nicolas Goaziou 2018-06-27 1:48 ` Robert Irelan 0 siblings, 1 reply; 11+ messages in thread From: Nicolas Goaziou @ 2018-05-07 20:38 UTC (permalink / raw) To: Robert Irelan; +Cc: bzg, Org-mode Hello, Robert Irelan <rirelan@gmail.com> writes: > I've rebased against latest master and attached the patch. It looks good, thank you. Would you mind proving a couple of regression tests, e.g., in "test-org-clock.el"? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-05-07 20:38 ` Nicolas Goaziou @ 2018-06-27 1:48 ` Robert Irelan 2018-06-27 6:32 ` Nicolas Goaziou 0 siblings, 1 reply; 11+ messages in thread From: Robert Irelan @ 2018-06-27 1:48 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: bzg, Org-mode [-- Attachment #1: Type: text/plain, Size: 464 bytes --] I've attached a patch on top of my first patch, containing tests. On Mon, May 7, 2018 at 1:38 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote: > > Hello, > > Robert Irelan <rirelan@gmail.com> writes: > > > I've rebased against latest master and attached the patch. > > It looks good, thank you. > > Would you mind proving a couple of regression tests, e.g., in > "test-org-clock.el"? > > Regards, > > -- > Nicolas Goaziou -- Robert Irelan rirelan@gmail.com [-- Attachment #2: 0002-Add-tests-for-clocktable-behavior-under-org-extend-t.patch --] [-- Type: text/x-patch, Size: 2595 bytes --] From a7b1a3163d36a7d715abcce096c60ec50bb40658 Mon Sep 17 00:00:00 2001 From: Robert Irelan <rmirelan@google.com> Date: Tue, 26 Jun 2018 18:33:39 -0700 Subject: [PATCH 2/2] Add tests for clocktable behavior under org-extend-today-until --- testing/lisp/test-org-clock.el | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el index e85325c14..abb3637bd 100644 --- a/testing/lisp/test-org-clock.el +++ b/testing/lisp/test-org-clock.el @@ -979,5 +979,55 @@ CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] => 8:00" (concat ":step day :tstart \"<2017-12-25 Mon>\" " ":tend \"<2017-12-27 Wed 23:59>\" :stepskip0 t"))))))) +(ert-deftest test-org-clock/clocktable/extend-today-until () + "Test assignment of clock time to days in presence of \"org-extend-today-until\"." + ;; Basic test of :block with org-extend-today-until - the report for + ;; 2017-09-30 should include the time clocked on 2017-10-01 before + ;; 04:00. + (should + (equal "| Headline | Time | +|--------------+--------| +| *Total time* | *2:00* | +|--------------+--------| +| Foo | 2:00 |" + (org-test-with-temp-text + "* Foo +CLOCK: [2017-09-30 Sat 12:00]--[2017-09-30 Sat 13:00] => 1:00 +CLOCK: [2017-10-01 Sun 02:00]--[2017-10-01 Sun 03:00] => 1:00 +CLOCK: [2017-10-01 Sun 11:00]--[2017-10-01 Sun 13:00] => 2:00" + (setq-local org-extend-today-until 4) + (let ((system-time-locale "en_US")) + (test-org-clock-clocktable-contents + ":block 2017-09-30"))))) + + ;; Week-length block - time on Monday before 04:00 should be + ;; assigned to previous week. + (should + (equal " +Weekly report starting on: [2017-10-01 Sun] +| Headline | Time | +|--------------+--------| +| *Total time* | *2:00* | +|--------------+--------| +| Foo | 2:00 | + +Weekly report starting on: [2017-10-02 Mon] +| Headline | Time | +|--------------+--------| +| *Total time* | *2:00* | +|--------------+--------| +| Foo | 2:00 | +" + (org-test-with-temp-text + "* Foo +CLOCK: [2017-10-01 Sun 12:00]--[2017-10-01 Sun 13:00] => 1:00 +CLOCK: [2017-10-02 Mon 02:00]--[2017-10-02 Mon 03:00] => 1:00 +CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 13:00] => 2:00" + (setq-local org-extend-today-until 4) + (let ((system-time-locale "en_US")) + (test-org-clock-clocktable-contents + ":step week :block 2017-10 :stepskip0 t")))))) + + (provide 'test-org-clock) ;;; test-org-clock.el end here -- 2.18.0.rc2.346.g013aa6912e-goog [-- Attachment #3: 0001-Make-org-extend-today-until-work-for-clocktable-bloc.patch --] [-- Type: text/x-patch, Size: 2918 bytes --] From dceba0d0964bce75cf78246f33becd0fbe543b7d Mon Sep 17 00:00:00 2001 From: Robert Irelan <rmirelan@google.com> Date: Mon, 30 Apr 2018 17:18:16 -0700 Subject: [PATCH 1/2] Make org-extend-today-until work for clocktable block org-clock: Properly handle `org-extend-today-until' in clock tables * lisp/org-clock.el (org-clock-special-range): Handle non-default `org-extend-today-until' when generating a clock table with the `:block` directive. Reported-by: Robert Irelan <rirelan@gmail.com> <http://lists.gnu.org/archive/html/emacs-orgmode/2018-04/msg00294.html> --- lisp/org-clock.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index b769a4fed..f2562fb6d 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -2200,13 +2200,17 @@ have priority." (`lastq (setq key 'quarter shift -1)))) ;; Prepare start and end times depending on KEY's type. (pcase key - ((or `day `today) (setq m 0 h 0 h1 24 d (+ d shift))) + ((or `day `today) (setq m 0 + h org-extend-today-until + h1 (+ 24 org-extend-today-until) + d (+ d shift))) ((or `week `thisweek) (let* ((ws (or wstart 1)) (diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws))))) - (setq m 0 h 0 d (- d diff) d1 (+ 7 d)))) + (setq m 0 h org-extend-today-until d (- d diff) d1 (+ 7 d)))) ((or `month `thismonth) - (setq h 0 m 0 d (or mstart 1) month (+ month shift) month1 (1+ month))) + (setq h org-extend-today-until m 0 d (or mstart 1) + month (+ month shift) month1 (1+ month))) ((or `quarter `thisq) ;; Compute if this shift remains in this year. If not, compute ;; how many years and quarters we have to shift (via floor*) and @@ -2224,14 +2228,16 @@ have priority." (setq shiftedy (- y (+ 1 (nth 0 tmp))) shiftedm (- 13 (* 3 (nth 1 tmp))) shiftedq (- 5 (nth 1 tmp))))) - (setq m 0 h 0 d 1 month shiftedm month1 (+ 3 shiftedm) y shiftedy)) + (setq m 0 h org-extend-today-until d 1 + month shiftedm month1 (+ 3 shiftedm) y shiftedy)) ((> (+ q shift) 0) ; Shift is within this year. (setq shiftedq (+ q shift)) (setq shiftedy y) (let ((qshift (* 3 (1- (+ q shift))))) - (setq m 0 h 0 d 1 month (+ 1 qshift) month1 (+ 4 qshift)))))) + (setq m 0 h org-extend-today-until d 1 + month (+ 1 qshift) month1 (+ 4 qshift)))))) ((or `year `thisyear) - (setq m 0 h 0 d 1 month 1 y (+ y shift) y1 (1+ y))) + (setq m 0 h org-extend-today-until d 1 month 1 y (+ y shift) y1 (1+ y))) ((or `interactive `untilnow)) ; Special cases, ignore them. (_ (user-error "No such time block %s" key))) ;; Format start and end times according to AS-STRINGS. -- 2.18.0.rc2.346.g013aa6912e-goog ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: Does :block field of clocktable respect org-extend-today-until? 2018-06-27 1:48 ` Robert Irelan @ 2018-06-27 6:32 ` Nicolas Goaziou 0 siblings, 0 replies; 11+ messages in thread From: Nicolas Goaziou @ 2018-06-27 6:32 UTC (permalink / raw) To: Robert Irelan; +Cc: bzg, Org-mode Hello, Robert Irelan <rirelan@gmail.com> writes: > I've attached a patch on top of my first patch, containing tests. Applied. Thank you! Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-06-27 6:33 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-04-17 5:51 Does :block field of clocktable respect org-extend-today-until? Robert Irelan 2018-04-17 12:54 ` Nicolas Goaziou 2018-05-01 0:30 ` Robert Irelan 2018-05-01 8:11 ` Bastien 2018-05-01 19:40 ` Robert Irelan 2018-05-07 17:43 ` Robert Irelan 2018-05-07 18:05 ` Nicolas Goaziou 2018-05-07 18:23 ` Robert Irelan 2018-05-07 20:38 ` Nicolas Goaziou 2018-06-27 1:48 ` Robert Irelan 2018-06-27 6:32 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).