emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: emacs-orgmode@gnu.org
Cc: Bernt Hansen <bernt@norang.ca>
Subject: [PATCH] Fix agenda display for late scheduled and deadline tasks
Date: Sat, 12 Jun 2010 12:13:55 -0400	[thread overview]
Message-ID: <1276359235-19934-1-git-send-email-bernt@norang.ca> (raw)
In-Reply-To: <1276358948-19543-1-git-send-email-bernt@norang.ca>

* lisp/org-agenda.el (org-agenda-get-deadlines):
(org-agenda-get-scheduled):
* lisp/org.el (org-time-string-to-seconds):
For deadline and scheduled agenda display ignore the cyclic repeater
when calculating how many days late the task is.  If you have a weekly
task and miss the date the agenda view will show more than a week late
now instead of resetting on the cyclic repeating date.  This makes it
much more obvious when you missed a repeating task after the repeater.
---
Updated patch - fixes DAYN -> DAYNR in the docstring.

-Bernt

 lisp/org-agenda.el |    4 ++--
 lisp/org.el        |   10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 93334b6..1977b84 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4573,7 +4573,7 @@ be skipped."
 	      pos (1- (match-beginning 1))
 	      d2 (org-time-string-to-absolute
 		  (match-string 1) d1 'past
-		  org-agenda-repeating-timestamp-show-all)
+		  org-agenda-repeating-timestamp-show-all t)
 	      diff (- d2 d1)
 	      wdays (if suppress-prewarning
 			(let ((org-deadline-warning-days suppress-prewarning))
@@ -4675,7 +4675,7 @@ FRACTION is what fraction of the head-warning time has passed."
 	      pos (1- (match-beginning 1))
 	      d2 (org-time-string-to-absolute
 		  (match-string 1) d1 'past
-		  org-agenda-repeating-timestamp-show-all)
+		  org-agenda-repeating-timestamp-show-all t)
 	      diff (- d2 d1))
 	(setq pastschedp (and todayp (< diff 0)))
 	;; When to show a scheduled item in the calendar:
diff --git a/lisp/org.el b/lisp/org.el
index 5cbd10a..f23a9e8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14683,18 +14683,20 @@ days in order to avoid rounding problems."
 (defun org-time-string-to-seconds (s)
   (org-float-time (org-time-string-to-time s)))
 
-(defun org-time-string-to-absolute (s &optional daynr prefer show-all)
+(defun org-time-string-to-absolute (s &optional daynr prefer show-all ignore-cyclic)
   "Convert a time stamp to an absolute day number.
-If there is a specifyer for a cyclic time stamp, get the closest date to
+If there is a specifier for a cyclic time stamp, get the closest date to
 DAYNR.
 PREFER and SHOW-ALL are passed through to `org-closest-date'.
-the variable date is bound by the calendar when this is called."
+the variable date is bound by the calendar when this is called.
+IGNORE-CYCLIC ignores cyclic repeaters so the returned absolute date
+is based on the original date."
   (cond
    ((and daynr (string-match "\\`%%\\((.*)\\)" s))
     (if (org-diary-sexp-entry (match-string 1 s) "" date)
 	daynr
       (+ daynr 1000)))
-   ((and daynr (string-match "\\+[0-9]+[dwmy]" s))
+   ((and (not ignore-cyclic) daynr (string-match "\\+[0-9]+[dwmy]" s))
     (org-closest-date s (if (and (boundp 'daynr) (integerp daynr)) daynr
 			  (time-to-days (current-time))) (match-string 0 s)
 			  prefer show-all))
-- 
1.7.1.256.g3499

  reply	other threads:[~2010-06-12 16:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-12 16:09 [PATCH] Fix agenda display for late scheduled and deadline tasks Bernt Hansen
2010-06-12 16:13 ` Bernt Hansen [this message]
2010-06-16 14:16   ` Bastien
2010-06-21 12:45   ` Matt Lundin
2010-06-21 12:51     ` Bernt Hansen
2010-06-21 13:02       ` Bernt Hansen
2010-06-21 13:06         ` Carsten Dominik
2010-06-21 13:08           ` Bernt Hansen
2010-06-21 13:21             ` Carsten Dominik
2010-06-22 21:40               ` [PATCH v2] " Bernt Hansen
2010-06-23 15:26                 ` Carsten Dominik
2010-06-23 15:38                   ` Bernt Hansen
2010-06-23 15:42                     ` Carsten Dominik
2010-07-01 13:00                 ` Carsten Dominik
2010-07-01 13:19                   ` Bernt Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276359235-19934-1-git-send-email-bernt@norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).