[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] patch: planner-deadline.el: don't update if task is
From: |
Dryice Liu |
Subject: |
[emacs-wiki-discuss] patch: planner-deadline.el: don't update if task is done or canceled |
Date: |
Wed, 22 Dec 2004 16:46:52 +0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (berkeley-unix) |
I used planner-deadline for a week and notice that
planner-deadline-update will update the "overdue" info even if the
task is done or canceled. This is pretty annoying when calling from a
plan page: all my done and canceled tasks get overdue :(
Here is a patch to prevent that (most are white space changes,
sorry). And a small helper function planner-deadline-change to save
some key stocks :)
======================================================================
--- planner-deadline.el.orig Wed Dec 15 10:14:07 2004
+++ planner-deadline.el Wed Dec 22 16:36:37 2004
@@ -56,30 +56,49 @@
planner-deadline-regexp) nil t)
(let* ((info (planner-current-task-info))
(description (planner-task-description info))
+ (status (planner-task-status info))
diff)
- (when (and (planner-task-date info)
- (string-match planner-deadline-regexp
- description))
- (setq diff
- (- (calendar-absolute-from-gregorian
- (planner-filename-to-calendar-date
- (match-string 2 description)))
- (calendar-absolute-from-gregorian
- (planner-filename-to-calendar-date
- (planner-task-date info)))))
- (planner-edit-task-description
- (replace-match
- (concat "{{Deadline: "
- (match-string 2 description)
- " - "
- (cond
- ((< diff 0) (format "%d days *OVERDUE*"
- (- diff)))
- ((= diff 0) "*TODAY*")
- (t (format "%d days" diff)))
- "}}")
- t t description 1))
- (forward-line 1)))))
+ (if (and (not (equal status "X")) (not (equal status "C")))
+ (when (and (planner-task-date info)
+ (string-match planner-deadline-regexp
+ description))
+ (setq diff
+ (- (calendar-absolute-from-gregorian
+ (planner-filename-to-calendar-date
+ (match-string 2 description)))
+ (calendar-absolute-from-gregorian
+ (planner-filename-to-calendar-date
+ (planner-task-date info)))))
+ (planner-edit-task-description
+ (replace-match
+ (concat "{{Deadline: "
+ (match-string 2 description)
+ " - "
+ (cond
+ ((< diff 0) (format "%d days *OVERDUE*"
+ (- diff)))
+ ((= diff 0) "*TODAY*")
+ (t (format "%d days" diff)))
+ "}}")
+ t t description 1))
+ (forward-line 1))))))
+
+(defun planner-deadline-change (&optional date)
+ "Change the deadline of current task to date, prompt if not
+given. Remove deadline if nil is given."
+ (interactive (list (planner-read-date)))
+ (let* ((info (planner-current-task-info))
+ (description (planner-task-description info))
+ new-description)
+ (if (string-match planner-deadline-regexp description)
+ (setq new-description (replace-match "" t t description)))
+ (if date
+ (planner-edit-task-description (concat new-description
+ "{{Deadline: "
+ date
+ "}}"))
+ (planner-edit-task-description new-description)))
+ (planner-deadline-update))
(provide 'planner-deadline)
======================================================================
--
Cheers,
Dryice
http://dryice.3322.org
- [emacs-wiki-discuss] patch: planner-deadline.el: don't update if task is done or canceled,
Dryice Liu <=