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 "[EMAIL PROTECTED]") (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
--- orig/planner-tasks-overview.el +++ mod/planner-tasks-overview.el @@ -55,8 +55,16 @@ ;; http://sacha.free.net.ph/notebook/wiki/PlannerMode.php +;;;_* Options + +(defcustom planner-tasks-overview-format-tasks-function 'planner-tasks-overview-insert-it + "Called to format tasks overview." + :type 'function + :group 'planner) + ;;; Code: + (defvar planner-tasks-overview-mode-map (let ((map (make-sparse-keymap))) (define-key map "1" 'planner-tasks-overview-sort-by-date) @@ -161,45 +169,49 @@ '("_" "o" ">" "P" "X" "C"))))))) (planner-tasks-overview-insert)) +(defun planner-tasks-overview-insert-it () + "Insert the textual representation for `planner-tasks-overview-data'." + (let (last-date last-plan) + (mapcar + (lambda (item) + (let ((text + (format "%10s | %s | %s %s | %s\n" + (if (elt item 2) + (planner-make-link + (elt item 2) + (format "%-10.10s" + (if (string= last-date (elt item 2)) + "__________" + (elt item 2)))) + (format "%-10.10s" "nil")) + (if (elt item 3) + (planner-make-link + (elt item 3) + (format "%-20.20s" + (if (string= last-plan (elt item 3)) + "____________________" + (elt item 3)))) + (format "%-20.20s" "nil")) + (elt item 0) + (elt item 1) + (elt item 4)))) + (add-text-properties 0 (length text) (list 'info item) + text) + (insert text)) + (setq last-date (elt item 2)) + (setq last-plan (elt item 3))) + planner-tasks-overview-data))) + (defun planner-tasks-overview-insert () "Insert the textual representation for `planner-tasks-overview-data'. DATA is a list of (priority status date plan description)." (with-current-buffer (get-buffer-create "*planner tasks overview*") (setq buffer-read-only nil) (erase-buffer) - (let (last-date last-plan) - (mapcar - (lambda (item) - (let ((text - (format "%10s | %s | %s %s | %s\n" - (if (elt item 2) - (planner-make-link - (elt item 2) - (format "%-10.10s" - (if (string= last-date (elt item 2)) - "__________" - (elt item 2)))) - (format "%-10.10s" "nil")) - (if (elt item 3) - (planner-make-link - (elt item 3) - (format "%-20.20s" - (if (string= last-plan (elt item 3)) - "____________________" - (elt item 3)))) - (format "%-20.20s" "nil")) - (elt item 0) - (elt item 1) - (elt item 4)))) - (add-text-properties 0 (length text) (list 'info item) - text) - (insert text)) - (setq last-date (elt item 2)) - (setq last-plan (elt item 3))) - planner-tasks-overview-data) - (planner-mode) - (goto-char (point-min)) - (setq buffer-read-only t)))) + (funcall planner-tasks-overview-format-tasks-function) + (planner-mode) + (goto-char (point-min)) + (setq buffer-read-only t))) ;; (planner-tasks-overview-extract-all-tasks (planner-get-day-pages start end)) ;; (planner-tasks-overview-extract-all-tasks (planner-get-day-pages (planner-today))) @@ -210,7 +222,10 @@ (cd (planner-directory)) ;; The following line greps only the days limited by START and END. (apply 'call-process "grep" nil t nil "-H" "-e" "^#[A-C][0-9]*" - file-list) + (mapcar + '(lambda (x) + (if muse-file-extension (concat x "." muse-file-extension) + x)) file-list)) ;;; The following line searches all the date pages. ;; (shell-command "grep -H -e '^#[A-C][0-9]*' --include='[0-9][0-9][0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]' *" t) ;;; The following line searches date _and_ plan pages.
_______________________________________________ emacs-wiki-discuss mailing list emacs-wiki-discuss@nongnu.org http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss