emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug fix and org-agenda-todo-ignore-deadlines option
@ 2006-10-06  1:15 Piotr Zielinski
  2006-10-10 11:54 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Piotr Zielinski @ 2006-10-06  1:15 UTC (permalink / raw)
  To: emacs-orgmode

Carsten,

Here's a patch that adds a new option
org-agenda-todo-ignore-deadlines.  If set to t (default nil), the
global todo list does not display deadlines which are closer than
org-deadline-warning-days, because such deadlines will be displayed by
the agenda anyway.  Besides, it fixes a bug with
org-agenda-todo-ignore-scheduled.

Piotr

--- org.el      2006-10-04 11:14:17.000000000 +0200
+++ /home/pz215/myfiles/emacs/org.el    2006-10-06 03:09:24.000000000 +0200
@@ -1635,6 +1635,14 @@
   :group 'org-todo
   :type 'boolean)

+(defcustom org-agenda-todo-ignore-deadlines nil
+  "Non-nil means, don't show entries in the global todo list that
+have a deadline within the next org-deadline-warning-days
+days. The idea behind this is that by such items will appear in the
deadline list anyway."
+  :group 'org-agenda
+  :group 'org-todo
+  :type 'boolean)
+
 (defcustom org-timeline-show-empty-dates 3
   "Non-nil means, `org-timeline' also shows dates without an entry.
 When nil, only the days which actually have entries are shown.
@@ -5998,6 +6006,15 @@
       (setq ans1 (format-time-string "%Y-%m-%d" time)))
     (if (active-minibuffer-window) (exit-minibuffer))))

+(defun org-days-to-time (timestamp-string)
+  (- (time-to-days (org-time-string-to-time timestamp-string))
+     (time-to-days (current-time))))
+
+(defun org-deadline-close (timestamp-string &optional ndays)
+  (and (< (org-days-to-time timestamp-string)
+         (or ndays org-deadline-warning-days))
+       (not (org-entry-is-done-p))))
+
 (defun org-check-deadlines (ndays)
   "Check if there are any deadlines due or past due.
 A deadline is considered due if it happens within `org-deadline-warning-days'
@@ -6013,12 +6030,7 @@
         (case-fold-search nil)
         (regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>"))
         (callback
-         (lambda ()
-           (and (let ((d1 (time-to-days (current-time)))
-                      (d2 (time-to-days
-                           (org-time-string-to-time (match-string 1)))))
-                  (< (- d2 d1) org-warn-days))
-                (not (org-entry-is-done-p))))))
+         (lambda () (org-deadline-close (match-string 1) org-warn-days))))
     (message "%d deadlines past-due or due within %d days"
             (org-occur regexp nil callback)
             org-warn-days)))
@@ -8057,17 +8069,24 @@
                                     "\\)\\>")
                           org-not-done-regexp)
                         "[^\n\r]*\\)"))
-        (sched-re (concat ".*\n?.*?" org-scheduled-time-regexp))
+        (deadline-re (concat ".*\\(\n[^*].*\\)?" org-deadline-time-regexp))
+        (sched-re (concat ".*\\(\n[^*].*\\)?" org-scheduled-time-regexp))
         marker priority category tags
         ee txt)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
-       (when (and org-agenda-todo-ignore-scheduled
-                  (looking-at sched-re))
-         ;; FIXME: the following test also happens below, but we need it here
-         (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
-         (throw :skip nil))
+       (save-match-data
+         (beginning-of-line)
+         (when (or (and org-agenda-todo-ignore-scheduled
+                        (looking-at sched-re))
+                   (and org-agenda-todo-ignore-deadlines
+                        (looking-at deadline-re)
+                        (org-deadline-close (match-string 2))))
+
+           ;; FIXME: the following test also happens below, but we need it here
+           (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
+           (throw :skip nil)))
        (org-agenda-skip)
        (goto-char (match-beginning 1))
        (setq marker (org-agenda-new-marker (1+ (match-beginning 0)))


-- 
Piotr Zielinski, Research Associate
Cavendish Laboratory, University of Cambridge, UK
http://www.cl.cam.ac.uk/~pz215/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug fix and org-agenda-todo-ignore-deadlines option
  2006-10-06  1:15 Bug fix and org-agenda-todo-ignore-deadlines option Piotr Zielinski
@ 2006-10-10 11:54 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2006-10-10 11:54 UTC (permalink / raw)
  To: Piotr Zielinski; +Cc: emacs-orgmode

I am taking this patch, thank you.

- Carsten

On Oct 6, 2006, at 3:15, Piotr Zielinski wrote:

> Carsten,
>
> Here's a patch that adds a new option
> org-agenda-todo-ignore-deadlines.  If set to t (default nil), the
> global todo list does not display deadlines which are closer than
> org-deadline-warning-days, because such deadlines will be displayed by
> the agenda anyway.  Besides, it fixes a bug with
> org-agenda-todo-ignore-scheduled.
>
> Piotr
>
> --- org.el      2006-10-04 11:14:17.000000000 +0200
> +++ /home/pz215/myfiles/emacs/org.el    2006-10-06 03:09:24.000000000 
> +0200
> @@ -1635,6 +1635,14 @@
>   :group 'org-todo
>   :type 'boolean)
>
> +(defcustom org-agenda-todo-ignore-deadlines nil
> +  "Non-nil means, don't show entries in the global todo list that
> +have a deadline within the next org-deadline-warning-days
> +days. The idea behind this is that by such items will appear in the
> deadline list anyway."
> +  :group 'org-agenda
> +  :group 'org-todo
> +  :type 'boolean)
> +
> (defcustom org-timeline-show-empty-dates 3
>   "Non-nil means, `org-timeline' also shows dates without an entry.
> When nil, only the days which actually have entries are shown.
> @@ -5998,6 +6006,15 @@
>       (setq ans1 (format-time-string "%Y-%m-%d" time)))
>     (if (active-minibuffer-window) (exit-minibuffer))))
>
> +(defun org-days-to-time (timestamp-string)
> +  (- (time-to-days (org-time-string-to-time timestamp-string))
> +     (time-to-days (current-time))))
> +
> +(defun org-deadline-close (timestamp-string &optional ndays)
> +  (and (< (org-days-to-time timestamp-string)
> +         (or ndays org-deadline-warning-days))
> +       (not (org-entry-is-done-p))))
> +
> (defun org-check-deadlines (ndays)
>   "Check if there are any deadlines due or past due.
> A deadline is considered due if it happens within 
> `org-deadline-warning-days'
> @@ -6013,12 +6030,7 @@
>         (case-fold-search nil)
>         (regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>"))
>         (callback
> -         (lambda ()
> -           (and (let ((d1 (time-to-days (current-time)))
> -                      (d2 (time-to-days
> -                           (org-time-string-to-time (match-string 
> 1)))))
> -                  (< (- d2 d1) org-warn-days))
> -                (not (org-entry-is-done-p))))))
> +         (lambda () (org-deadline-close (match-string 1) 
> org-warn-days))))
>     (message "%d deadlines past-due or due within %d days"
>             (org-occur regexp nil callback)
>             org-warn-days)))
> @@ -8057,17 +8069,24 @@
>                                     "\\)\\>")
>                           org-not-done-regexp)
>                         "[^\n\r]*\\)"))
> -        (sched-re (concat ".*\n?.*?" org-scheduled-time-regexp))
> +        (deadline-re (concat ".*\\(\n[^*].*\\)?" 
> org-deadline-time-regexp))
> +        (sched-re (concat ".*\\(\n[^*].*\\)?" 
> org-scheduled-time-regexp))
>         marker priority category tags
>         ee txt)
>     (goto-char (point-min))
>     (while (re-search-forward regexp nil t)
>       (catch :skip
> -       (when (and org-agenda-todo-ignore-scheduled
> -                  (looking-at sched-re))
> -         ;; FIXME: the following test also happens below, but we need 
> it here
> -         (or org-agenda-todo-list-sublevels (org-end-of-subtree 
> 'invisible))
> -         (throw :skip nil))
> +       (save-match-data
> +         (beginning-of-line)
> +         (when (or (and org-agenda-todo-ignore-scheduled
> +                        (looking-at sched-re))
> +                   (and org-agenda-todo-ignore-deadlines
> +                        (looking-at deadline-re)
> +                        (org-deadline-close (match-string 2))))
> +
> +           ;; FIXME: the following test also happens below, but we 
> need it here
> +           (or org-agenda-todo-list-sublevels (org-end-of-subtree 
> 'invisible))
> +           (throw :skip nil)))
>        (org-agenda-skip)
>        (goto-char (match-beginning 1))
>        (setq marker (org-agenda-new-marker (1+ (match-beginning 0)))
>
>
> -- 
> Piotr Zielinski, Research Associate
> Cavendish Laboratory, University of Cambridge, UK
> http://www.cl.cam.ac.uk/~pz215/
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>

--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-10 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-06  1:15 Bug fix and org-agenda-todo-ignore-deadlines option Piotr Zielinski
2006-10-10 11:54 ` Carsten Dominik

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).