planner-appt: fix highlighting in plan pages
[planner-el.git] / planner-wl.el
blob4f788e37728a2ea14685a9ac00b4876e0ec3578c
1 ;;; planner-wl.el --- Wanderlust integration for the Emacs Planner
3 ;; Copyright (C) 2004 Yvonne Thomson (yvonne AT netbrains DOT com DOT au)
4 ;; Parts copyright (C) 2004 Angus Lees (gus AT inodes DOT org)
6 ;; Author: Yvonne Thomson (yvonne AT thewatch DOT net)
7 ;; Keywords: planner, wanderlust, wl
8 ;; URL: http://www.plannerlove.com/
10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; This file is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
25 ;;; Commentary:
27 ;; Add
29 ;; (require 'planner-wl)
31 ;; to your .emacs or .wl. You will then be able to call
32 ;; M-x planner-create-task-from-buffer from Wanderlust summary buffers
33 ;; with the correct annotation.
35 ;; To add keybindings to Wanderlust, call (from .emacs or .wl)
37 ;; (planner-wl-insinuate)
39 ;; This binds F in summary buffers to `planner-create-task-from-buffer'
41 ;; Note:
42 ;; `planner-wl-annotation-from-wl' uses `wl-summary-from-function' (and
43 ;; related options) rather than `planner-ignored-from-addresses'
45 ;; URLs are of the form wl://foldername/msg-id
47 ;;;_ + Contributors
49 ;; Angus Lees (gus AT inodes DOT org) remade quite a bit of this file.
51 ;; Jeremy Cowgar (jeremy AT cowgar DOT com) updated this to work with
52 ;; Wanderlust 2.12.0.
54 ;;; Code:
56 (require 'planner)
57 (require 'wl)
58 (require 'wl-summary)
60 ;;;###autoload
61 (defun planner-wl-insinuate ()
62 "Hook Planner into Wanderlust.
64 Adds special planner keybindings to the variable `wl-summary-mode-map'.
65 From the Wanderlust Summary view, you can type:
67 F planner-task-from-wl"
68 (define-key wl-summary-mode-map "F" 'planner-create-task-from-buffer))
70 ;;;###autoload
71 (defun planner-wl-annotation-from-wl ()
72 "If called from wl, return an annotation.
73 Suitable for use in `planner-annotation-functions'."
74 (when (equal major-mode 'wl-summary-mode)
75 (let* ((msgnum (wl-summary-message-number))
76 (msg-id (elmo-message-field wl-summary-buffer-elmo-folder
77 msgnum 'message-id))
78 (wl-message-entity
79 (if (fboundp 'elmo-message-entity)
80 (elmo-message-entity
81 wl-summary-buffer-elmo-folder msgnum)
82 (elmo-msgdb-overview-get-entity
83 msgnum (wl-summary-buffer-msgdb)))))
84 (planner-make-link
85 (concat "wl://" wl-summary-buffer-folder-name "/" msg-id)
86 (concat "E-Mail " (wl-summary-line-from))
87 t))))
89 ;;;###autoload
90 (defun planner-wl-browse-url (url)
91 "If this is a Wanderlust URL, jump to it."
92 (when (string-match "\\`wl:/*\\(.+\\)/\\(.+\\)" url)
93 (let ((group (match-string 1 url))
94 (article (match-string 2 url)))
95 (wl-summary-goto-folder-subr group 'no-sync t nil t)
96 (wl-summary-jump-to-msg-by-message-id article)
97 (wl-summary-redisplay)
98 ;; force a non-nil return value
99 t)))
101 (planner-add-protocol "wl:/*" 'planner-wl-browse-url nil)
102 (custom-add-option 'planner-annotation-functions
103 'planner-wl-annotation-from-wl)
104 (add-hook 'planner-annotation-functions 'planner-wl-annotation-from-wl)
106 (provide 'planner-wl)
108 ;;; planner-wl.el ends here