Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Here is a patch with that addition to ORG-NEWS. From 18d0d67f7f0efd635351056c185b46e2c2a54d5e Mon Sep 17 00:00:00 2001 From: Don March <d...@ohspite.net> Date: Sat, 2 Jul 2016 02:39:58 -0400 Subject: [PATCH] ORG-NEWS: document last "++" repeater change --- etc/ORG-NEWS | 9 + 1 file changed, 9 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index ea9e4de..71f44f5 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -447,6 +447,15 @@ Thus the new behavior is to generate this HTML link instead: : http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#List-Buffers;>emacs#List Buffers All emacs related info links are similarly translated plus few other =gnu.org= manuals. +*** Repeaters with a "++" interval and a time can be shifted to later today +Previously, if a recurring task had a timestamp of +=<2016-01-01 Fri 20:00 ++1d>= and was completed on 2016-01-02 at +08:00, the task would skip 2016-01-02 and would be rescheduled for +2016-01-03. Timestamps with "++" cookies and a specific time will now +shift to the first possible future occurrence, even if the occurrence +is later the same day the task is completed. (Timestamps already in +the future are still shifted one time further into the future.) + * Version 8.3 ** Incompatible changes -- 2.8.1
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Nicolas Goaziouwrites: > Would you mind providing a note about this change in ORG-NEWS? No problem. Would you put that in "new features" or "miscellaneous"?
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > Don March <d...@donmarch.net> writes: >> If you have a task with the following timestamp: >> >> SCHEDULED: <2016-06-19 Sun 21:00 ++1w> >> >> then marking it as DONE at [2016-06-27 at 07:00] should [...] > ISYM [2016-06-26 at 07:00]. Yes :) Thanks for understanding anyway. (and ITYM "ITYM", maybe?) > You should merge both `or'. Also, (equal time (current-time)) is always > nil since they don't have the same structure. You're right about both things. I updated the patch, and also added an example to the manual. If that's not what you had it mind, let me know or feel free to edit. On Thu, Jun 30, 2016 at 8:16 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote: > Hello, > > Don March <d...@donmarch.net> writes: > >> If you have a task with the following timestamp: >> >> SCHEDULED: <2016-06-19 Sun 21:00 ++1w> >> >> then marking it as DONE at [2016-06-27 at 07:00] should (debatably) >> result in > > ISYM [2016-06-26 at 07:00]. > >> SCHEDULED: <2016-06-26 Sun 21:00 ++1w> >> >> but instead it becomes >> >> SCHEDULED: <2016-07-03 Sun 21:00 ++1w> > > With the correction above, it makes sense, indeed. > >> - (<= (time-to-days time) >> - (time-to-days (current-time >> + (or (time-less-p time (current-time)) >> + (equal time (current-time > > You should merge both `or'. Also, (equal time (current-time)) is always > nil since they don't have the same structure. > > You could write instead > > (while (or (= nshift 0) > (not (time-less-p (current-time) time))) > ...) > > It would be nice to add an explanation along with an example about that > in the manual, too. WDYT? > > Thank you for your patch. > > Regards, > > -- > Nicolas Goaziou From 5b5fe9b5028d2074c30f271dbc2d63984da2ff19 Mon Sep 17 00:00:00 2001 From: Don March <d...@ohspite.net> Date: Sun, 26 Jun 2016 23:35:44 -0700 Subject: [PATCH] Reschedule "++" repeaters on same day if in future * lisp/org.el (org-auto-repeat-maybe): Include the time in a timestamp (hours and minutes) when checking if a repeat occurrence is in the future. * doc/org.texi (Repeated Tasks): Document repeat occurrences with a time in the timestamp. --- doc/org.texi | 7 +++ lisp/org.el | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index ae9a738..9d8eb8f 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -6412,6 +6412,13 @@ special repeaters @samp{++} and @samp{.+}. For example: but also by as many weeks as it takes to get this date into the future. However, it stays on a Sunday, even if you called and marked it done on Saturday. +** TODO Empty kitchen trash + DEADLINE: <2008-02-08 Fri 20:00 ++1d> + Marking this DONE will shift the date by at least one day, and + also by as many days as it takes to get the timestamp into the + future. Since there is a time in the timestamp, the next + deadline in the future will be on today's date if you + complete the task before 20:00. ** TODO Check the batteries in the smoke detectors DEADLINE: <2005-11-01 Tue .+1m> Marking this DONE will shift the date to one month after diff --git a/lisp/org.el b/lisp/org.el index e13e82d..c266709 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13287,8 +13287,7 @@ has been set" (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) - (<= (time-to-days time) - (time-to-days (current-time + (time-less-p time (current-time))) (when (= (cl-incf nshift) nshiftmax) (or (y-or-n-p (format "%d repeater intervals were not \ -- 2.8.1
[O] [PATCH] Reschedule "++" repeaters on same day if in future
If you have a task with the following timestamp: SCHEDULED: <2016-06-19 Sun 21:00 ++1w> then marking it as DONE at [2016-06-27 at 07:00] should (debatably) result in SCHEDULED: <2016-06-26 Sun 21:00 ++1w> but instead it becomes SCHEDULED: <2016-07-03 Sun 21:00 ++1w> The attached patch changes the behavior to not skip a repeat occurrence that would occur on the day that a task is completed, if there is a time in the timestamp and it is after the current time. This is really useful, at least for me, and also matches a literal reading of the docs. They say (regarding a "++1w" repeater) #+BEGIN_QUOTE Marking this DONE will shift the date by at least one week, but also by as many weeks as it takes to get this date into the future. #+END_QUOTE With a time before the repeater SCHEDULED: <2016-06-19 Sun 21:00 ++1w> you seem to be saying that you don't start working on this task until Sunday evening every week. If you get busy and don't mark it DONE until the next Sunday morning, then you must be talking about the previous instance, not the repeat occurrence which will become available later that day. So it makes sense to increase the timestamp to later that day: SCHEDULED: <2016-06-26 Sun 21:00 ++1w> For another example, suppose you empty the kitchen trash every night: SCHEDULED: <2016-06-19 Sun 22:00 ++1d> If you don't complete that occurrence for two days and then empty the trash on Tuesday morning, you would still want to empty it that night: SCHEDULED: <2016-06-21 Tue 22:00 ++1d> as opposed to skipping Tuesday night and repeating on Wednesday. These examples seem useful to me. But this change could, in theory, lead to the absurd situation of rescheduling a task for just a couple minutes after its completion. But to me that seems the lesser of two evils; you just mark it DONE again, versus the alternative of thinking that you'll be reminded of a task only to forget all about it. If the task is *already* scheduled for later today, this patch does not affect the current behavior--the task will still be rescheduled on the next occurrence on some future day. From 59328aa0089bb376df86c89128a741a59d41c378 Mon Sep 17 00:00:00 2001 From: Don March <d...@ohspite.net> Date: Sun, 26 Jun 2016 23:35:44 -0700 Subject: [PATCH] Reschedule "++" repeaters on same day if in future * lisp/org.el (org-auto-repeat-maybe): Include a time in a timestamp (hours and minutes) when checking if a repeat occurrence is in the future. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index e13e82d..0b102fb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13287,8 +13287,8 @@ has been set" (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) - (<= (time-to-days time) - (time-to-days (current-time + (or (time-less-p time (current-time)) + (equal time (current-time (when (= (cl-incf nshift) nshiftmax) (or (y-or-n-p (format "%d repeater intervals were not \ -- 2.8.1
Re: [O] [PATCH] Make today's deadlines "close" without lead time
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > Thank you for the patch. And thank you for your thousands of patches! > Did you sign FSF papers? Yes, August 2011, #699456. > Also, would you mind providing a few tests for this function, in > "test-org.el"? Not at all. The new patch---which includes the original changes and the new tests---is attached. While I was in there, I made a second patch that renames the function to have a `-p' predicate suffix. Hopefully I put the tests somewhere close to where they belong. From 4953e495b938011582fb0c7c7bf9064530ce9294 Mon Sep 17 00:00:00 2001 From: Don March <d...@ohspite.net> Date: Wed, 1 Jun 2016 00:05:12 -0400 Subject: [PATCH 1/2] Make today's deadlines "close" without lead time * lisp/org.el (org-deadline-close): A timestamp is close if the days between now and the timestamp are less then or equal to the days of lead time. * testing/lisp/test-org.el: Add tests for org-deadline-close. --- lisp/org.el | 2 +- testing/lisp/test-org.el | 28 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index e015a77..13883c5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17480,7 +17480,7 @@ If SECONDS is non-nil, return the difference in seconds." (defun org-deadline-close (timestamp-string ndays) "Is the time in TIMESTAMP-STRING close to the current date?" (setq ndays (or ndays (org-get-wdays timestamp-string))) - (and (< (org-time-stamp-to-now timestamp-string) ndays) + (and (<= (org-time-stamp-to-now timestamp-string) ndays) (not (org-entry-is-done-p (defun org-get-wdays (ts delay zero-delay) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 6884c24..576402a 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -364,6 +364,34 @@ (calendar-gregorian-from-absolute (org-closest-date "<2012-03-29 +2y>" "<2014-03-04>" 'future) +(ert-deftest test-org/deadline-close () + "Test `org-deadline-close' specifications." + ;; Pretend that the current time is 2016-06-03 Fri 01:43 + (cl-flet ((current-time () '(22353 6425 905205 644000))) +;; Timestamps are close if they are within `ndays' of lead time. +(org-test-with-temp-text "* Heading" + (should (org-deadline-close "2016-06-03 Fri" 0)) + (should (org-deadline-close "2016-06-02 Thu" 0)) + (should-not (org-deadline-close "2016-06-04 Sat" 0)) + (should (org-deadline-close "2016-06-04 Sat" 1)) + (should (org-deadline-close "2016-06-03 Fri 12:00" 0))) +;; Read `ndays' from timestamp if argument not given. +(org-test-with-temp-text "* H" + (should (org-deadline-close "2016-06-04 Sat -1d")) + (should-not (org-deadline-close "2016-06-04 Sat -0d")) + (should (org-deadline-close "2016-06-10 Fri -1w")) + (should-not (org-deadline-close "2016-06-11 Sat -1w"))) +;; Prefer `ndays' argument over lead time in timestamp. +(org-test-with-temp-text "* H" + (should (org-deadline-close "2016-06-04 Sat -0d" 1)) + (should-not (org-deadline-close "2016-06-04 Sat -0d" 0))) +;; Completed tasks are never close. +(let ((org-todo-keywords '(("TODO" "|" "DONE" + (org-test-with-temp-text "* TODO Heading" + (should (org-deadline-close "2016-06-03"))) + (org-test-with-temp-text "* DONE Heading" + (should-not (org-deadline-close "2016-06-03")) + ;;; Drawers -- 2.8.1 From 143f802073989fff8fe464244f53089e79e92812 Mon Sep 17 00:00:00 2001 From: Don March <d...@ohspite.net> Date: Fri, 3 Jun 2016 02:49:55 -0400 Subject: [PATCH 2/2] Rename org-deadline-is-close to have -p suffix * lisp/org-agenda.el (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): * lisp/org.el (org-deadline-close): Rename to... (org-deadline-close-p): ...this. * testing/lisp/test-org.el (test-org/deadline-close): Rename to... (test-org/deadline-close-p): ...this. --- lisp/org-agenda.el | 4 ++-- lisp/org.el | 4 ++-- testing/lisp/test-org.el | 30 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 50f520c..7994187 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5550,7 +5550,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', (cond ((memq org-agenda-todo-ignore-deadlines '(t all)) t) ((eq org-agenda-todo-ignore-deadlines 'far) - (not (org-deadline-close (match-string 1 + (not (org-deadline-close-p (match-string 1 ((eq org-agenda-todo-ignore-deadlines 'future) (> (org-time-stamp-to-now (match
[O] [PATCH] Make today's deadlines "close" without lead time
This patch makes a very small change to the function that determines if a timestamp is close to the current day, which is used for showing/hiding items in agenda views. Under current behavior, a deadline of today is close only if it has some amount of lead time. If your date is 2016-06-01, the following statements evaluate to nil: #+BEGIN_SRC emacs-lisp (org-deadline-close "2016-06-01 Wed -0d") ;; but this is today! (org-deadline-close "2016-06-02 Wed -1d") #+END_SRC One effect of this is that if you set =org-agenda-todo-ignore-deadlines= to =far= and generate the TODO list agenda view (C-c a t), then items only appear if you are one day past the point at which they should appear. For example, the following item does not show up in my current TODO list: #+BEGIN_EXAMPLE * TODO due today, no lead time DEADLINE: <2016-06-01 -0d> #+END_EXAMPLE From 5401da2076b9de890fbf086e472c09c3f0a66fdf Mon Sep 17 00:00:00 2001 From: Don March <d...@ohspite.net> Date: Wed, 1 Jun 2016 00:05:12 -0400 Subject: [PATCH] Make today's deadlines "close" without lead time * org.el (org-deadline-close): A timestamp is close if the days between now and the timestamp are less then or equal to the days of lead time. --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 680086d..fb9e101 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17479,7 +17479,7 @@ If SECONDS is non-nil, return the difference in seconds." (defun org-deadline-close (timestamp-string ndays) "Is the time in TIMESTAMP-STRING close to the current date?" (setq ndays (or ndays (org-get-wdays timestamp-string))) - (and (< (org-time-stamp-to-now timestamp-string) ndays) + (and (<= (org-time-stamp-to-now timestamp-string) ndays) (not (org-entry-is-done-p (defun org-get-wdays (ts delay zero-delay) -- 2.8.1
[Orgmode] Re: quotation marks in LaTeX (again)
Sven Bretfeld sven.bretf...@gmx.ch writes: The different styles of quotation marks needed for different languages might also be a problem for a regexp solution. I'm using the \enquote method since quite a while and write English and German text in that way without further user interference. \enquote just picks the correct version in dependency of the babel environment. Definitely--I agree that the csquotes solution is probably best, but since Carsten said that would probably be an option there needs to be a vanilla LaTeX solution too. ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Re: quotation marks in LaTeX (again)
Carsten Dominik carsten.domi...@gmail.com writes: On Oct 4, 2010, at 10:00 PM, Don March wrote: Implementing the \enquote solution proposed by Sven Bretfeld Could you please point me to that earlier discussion? I cannot find it right now. Sure--[feature request] Quotation marks in LaTeX export, 2010-01-22, http://article.gmane.org/gmane.emacs.orgmode/21588 So I was working on a regexp fix for this, but then I realized that there's a host of cases where the beginning quote isn't recognized as beginning because there isn't whitespace in front of it, such as when a quote starts a parenthetical (like this). Maybe the solution is to use the list of allowed chars in pre from org-emphasis-regexp-components? I'd be happy to work on this, by the way, but don't want to start on a solution that other people don't want. ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] quotation marks in LaTeX (again)
There's been some talk about quotation marks when exporting to LaTeX, but I've noticed some issues in addition (I think) to those mentioned by others. 'a quote' inside a quote is exported to LaTeX as ``'a quote' inside a quote'' but should be ``\,`a quote' inside a quote'' Similarly, a quote that ends with 'a quote' is exported as ``a quote that ends with `a quote''' but should be ``a quote that ends with `a quote'\,'' Implementing the \enquote solution proposed by Sven Bretfeld would a fix for this, but that would probably have to be optional. So I was working on a regexp fix for this, but then I realized that there's a host of cases where the beginning quote isn't recognized as beginning because there isn't whitespace in front of it, such as when a quote starts a parenthetical (like this). Maybe the solution is to use the list of allowed chars in pre from org-emphasis-regexp-components? Don ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode