update to work with latest planner-publish.el
[planner-el.git] / planner-gnats.el
blobac53a3e18d7db1c4a6b813d1ed2214f0f43802c7
1 ;;; planner-gnats.el --- GNATS integration for the Emacs Planner
3 ;; Copyright (C) 2005 Jeremy Cowgar (jeremy AT cowgar DOT com)
5 ;; Author: Jeremy Cowgar (jeremy AT cowgar DOT com)
6 ;; Keywords: planner, gnats
7 ;; URL: http://www.plannerlove.com/
8 ;; URL: http://www.gnu.org/software/gnats/
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 ;; GNATS is the GNU problem report management system (central database)
28 ;; GNATS is a bug-tracking tool designed for use at a central "Support
29 ;; Site". Users who experience problems use electronic mail to
30 ;; communicate these problems to "maintainers" at that Support Site.
32 ;; Add
34 ;; (require 'planner-gnats)
36 ;; to your .emacs. You will then be able to call M-x
37 ;; planner-create-task-from-buffer from Gnats edit or view buffers
38 ;; with the correct annotation.
40 ;; To add keybindings to Gnats, call (from .emacs)
42 ;; (planner-gnats-insinuate)
45 ;; URLs are of the form gnats:pr-number
47 ;;; Todo::
49 ;; 1. The URL should really be something like
50 ;; gnats:database/pr-number however, I'm not yet certian how to
51 ;; handle all the possible variations to setup the correct server, for
52 ;; instance, port number, user name, password. The password could then
53 ;; get tricky, because what if the text file is stored in an unsecure
54 ;; manner?
56 ;; So, right now this assumes your gnats is already setup for the
57 ;; correct server, which will be the case for probably 90% of the
58 ;; users.
60 ;;; Code:
62 (require 'planner)
63 (require 'gnats)
65 ;;;###autoload
66 (defun planner-gnats-annotation-from-gnats ()
67 "If called from gnats-edit or gnats-view buffer, return an annotation.
68 Suitable for use in `planner-annotation-functions'."
69 (when (string-match "^\\*gnats-\\(edit\\|\\view\\)-\\(.+\\)\\*"
70 (buffer-name))
71 (let ((pr-num (match-string 2 (buffer-name))))
72 (planner-make-link
73 (concat "gnats:" pr-num)
74 (concat "Gnats Bug: " pr-num)
75 t))))
77 ;;;###autoload
78 (defun planner-gnats-browse-url (url)
79 "If this is a Gnats URL, view the pr (view-pr)."
80 (when (string-match "\\`gnats:/*\\(.+\\)" url)
81 (let ((pr-num (match-string 1 url)))
82 (view-pr (string-to-number pr-num)))
83 t))
85 (planner-add-protocol "gnats:/*" 'planner-gnats-browse-url nil)
86 (custom-add-option 'planner-annotation-functions
87 'planner-gnats-annotation-from-gnats)
88 (add-hook 'planner-annotation-functions 'planner-gnats-annotation-from-gnats)
90 (provide 'planner-gnats)
92 ;;; planner-gnats.el ends here