1 ;;; planner-erc.el --- ERC support for Planner, an organizer for Emacs
3 ;; Copyright (C) 2004 Free Software Foundation, Inc.
9 ;;;_ + Package description
11 ;; Emacs Lisp Archive Entry
12 ;; Filename: planner-erc.el
13 ;; Keywords: hypermedia erc chat
14 ;; Author: Sacha Chua <sacha@free.net.ph>
15 ;; Description: Create tasks and notes based on IRC
16 ;; URL: http://www.plannerlove.com/
17 ;; Compatibility: Emacs20, Emacs21, XEmacs21
19 ;; This file is not part of GNU Emacs.
21 ;; This is free software; you can redistribute it and/or modify it under
22 ;; the terms of the GNU General Public License as published by the Free
23 ;; Software Foundation; either version 2, or (at your option) any later
26 ;; This is distributed in the hope that it will be useful, but WITHOUT
27 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
31 ;; You should have received a copy of the GNU General Public License
32 ;; along with GNU Emacs; see the file COPYING. If not, write to the
33 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
34 ;; Boston, MA 02110-1301, USA.
38 ;; Place planner-erc.el in your load path and add this to your .emacs:
40 ;; (require 'planner-erc)
42 ;; ERC URLs are of the form
44 ;; erc://server/nick/channel or
45 ;; erc://server/nick or
48 ;; Annotations will be of the form
49 ;; [[erc://server/nick/#channel][Chat with nick on server#channel]]
50 ;; [[erc://server/nick][Chat with nick on server]]
51 ;; [[erc://server][Chat on server]]
58 (defun planner-erc-annotation-from-erc ()
59 "Return an annotation for the current line.
60 This function can be added to `planner-annotation-functions'."
61 (when (eq major-mode
'erc-mode
)
62 (if (erc-default-target)
63 (if (erc-channel-p (erc-default-target))
64 (if (and (get-text-property (point) 'erc-parsed
)
65 (elt (get-text-property (point) 'erc-parsed
) 1))
69 (elt (get-text-property (point) 'erc-parsed
) 1)))))
72 erc-announced-server-name
"/"
73 (substring nick
1) ",isnick")
74 (concat "Chat with " nick
" on "
75 erc-announced-server-name
(erc-default-target))
79 erc-announced-server-name
"/"
81 (concat "Chat on " erc-announced-server-name
85 (concat "irc://" erc-announced-server-name
"/"
87 (concat "Chat with " (erc-default-target) " on "
88 erc-announced-server-name
)
91 (concat "irc://" erc-announced-server-name
)
92 (concat "Chat on " erc-announced-server-name
)
96 (defun planner-erc-browse-url (url)
97 "If this is an ERC URL, jump to it.
98 This just connects to the server--you have to join the channel or privmsg
100 ;; If anyone can figure out how to get it to automatically open the
101 ;; channel window, that would be ultra cool.
102 ;; Also, we need a way to canonicalize going to a particular server.
103 ;; But this will do for now.
104 (when (string-match "\\`[ei]rc://\\([^/]+\\)" url
)
105 (erc-select (match-string 1 url
))
109 (planner-add-protocol "[ei]rc://" 'planner-erc-browse-url
'identity
)
111 (add-hook 'planner-annotation-functions
'planner-erc-annotation-from-erc
)
112 (custom-add-option 'planner-annotation-functions
113 'planner-erc-annotation-from-erc
)
115 (planner-update-wiki-project)
116 (provide 'planner-erc
)
118 ;;;_* Local emacs vars.
121 ;; allout-layout: (* 0 : )
124 ;;; planner-erc.el ends here