[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
planner-tasks-overview.el patch + config to send weekly undone task repo
From: |
Janne Hellsten |
Subject: |
planner-tasks-overview.el patch + config to send weekly undone task reports in e-mail (was Re: [emacs-wiki-discuss] Re: migrating planner-tasks-overview.el to planner-muse) |
Date: |
Sun, 13 Nov 2005 21:11:06 +0200 |
Hi Seth,
> You might want something like:
>
> ;; untested!
> (lambda (x) (if muse-file-extension
> (concat x "." muse-file-extension)
> x))
Yep, it seemed to work so I changed to use that one.
> > I have my own fork of planner-tasks-overview and can live with this
> > limitations. My own fork contains changes that enable plain text
> > output of tasks summaries
> > -- I e-mail weekly tasks summaries to myself every morning.
>
> That sounds useful, would you mind posting what you have to generate
> plain text task summaries?
Yes, sure thing. I've attached a patch to planner-tasks-overview.el
that needs to be applied before using my configs below. I hope the
patch works, I find it really difficult to use Arch being used to
Darcs/Perforce/SVN myself.. The patch should not change
planner-tasks-overview functionality, it is just a small refactoring
to allow for changing the output format.
As for configuring Emacs to send task summaries in e-mail.. Here goes.
I've split the configuration into two parts: first one is the required
elisp configuration to format and send e-mails and the second part is
a shell script that I use with cron to actually launch emacs to send
e-mail every morning. The shell script most probably won't work out
of the box. If you want to try it out, the critical part is to modify
the load-path correctly for your setup. It really doesn't require wl
(wanderlust), it's just that my config for wl also sets up paths
properly for planner.
<clip>
;; planner-tasks-overview comes from my own patched version of
;; planner-tasks-overview.el.
(require 'planner-tasks-overview)
(defvar nurpa-mail-temp-buffer "*nurpa tasks mail template*")
(require 'sendmail)
(setq send-mail-function 'sendmail-send-it)
(defun janne/planner-tasks-overview-sort (field)
"Sort tasks first by date and then by priority."
(sort planner-tasks-overview-data
(lambda (a b)
(let ((date-a (elt a 2))
(date-b (elt b 2))
(pri-a (elt a 0))
(pri-b (elt b 0)))
(if (equal date-a date-b)
(string< pri-a pri-b)
(string< date-a date-b))))))
(defun janne/planner-tasks-overview-insert-it ()
"Insert the textual representation for `planner-tasks-overview-data'."
(let ((prev-date nil))
(mapcar
(lambda (item)
(let ((cur-date (elt item 2))
(text
(format "- %s [%s/%s %s]\n"
(elt item 4)
(if (elt item 3) (elt item 3) "")
(elt item 0) (elt item 1))))
(if (not (equal prev-date cur-date))
(progn
(insert (format "\n%s\n----------\n\n" cur-date))
(setq prev-date cur-date)))
(if (member (elt item 1) '("_" "o" ">" "P"))
(insert text))))
(janne/planner-tasks-overview-sort planner-tasks-overview-data))))
(custom-set-variables
'(planner-tasks-overview-format-tasks-function
'janne/planner-tasks-overview-insert-it))
(defvar nurpa-tasks-email-to-address "address@hidden")
(defvar nurpa-tasks-email-from-address nurpa-tasks-email-to-address)
(defun nurpa-tasks-email ()
(interactive)
;; NOTE: we need to go into "plan" first, otherwise old tasks are
;; not carried over from previous day to today's page and the sent
;; e-mail will miss some tasks.
(plan)
;; Go into tasks overview
(planner-tasks-overview (planner-expand-name "+0") (planner-expand-name "+7"))
(switch-to-buffer "*planner tasks overview*")
(copy-to-buffer nurpa-mail-temp-buffer 1 (point-max))
;; Format it as a mail:
(switch-to-buffer nurpa-mail-temp-buffer)
(goto-char 1)
(insert (format "From: %s\n" nurpa-tasks-email-from-address))
(insert (format "To: %s\n" nurpa-tasks-email-to-address))
(insert "Subject: NurpaOps: Tasks for the next 7 days\n")
(insert "--text follows this line--\n")
(funcall send-mail-function))
</clip>
And here's an example shell script for launching emacs to send tasks
summaries. To be used with cron.
<clip>
#!/bin/sh
emacs --batch --eval "(progn (load-file \"~/.emacs\") (require 'wl)
(load-file \"~/.wl\") (nurpa-tasks-email))"
</clip>
Best regards,
Janne
planner-tasks-overview.el.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- planner-tasks-overview.el patch + config to send weekly undone task reports in e-mail (was Re: [emacs-wiki-discuss] Re: migrating planner-tasks-overview.el to planner-muse),
Janne Hellsten <=