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 part of Planner. It is not part of GNU Emacs.
12 ;; Planner is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; Planner is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with Planner; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
29 ;; GNATS is the GNU problem report management system (central database)
30 ;; GNATS is a bug-tracking tool designed for use at a central "Support
31 ;; Site". Users who experience problems use electronic mail to
32 ;; communicate these problems to "maintainers" at that Support Site.
36 ;; (require 'planner-gnats)
38 ;; to your .emacs. You will then be able to call M-x
39 ;; planner-create-task-from-buffer from Gnats edit or view buffers
40 ;; with the correct annotation.
42 ;; To add keybindings to Gnats, call (from .emacs)
44 ;; (planner-gnats-insinuate)
47 ;; URLs are of the form gnats:pr-number
51 ;; 1. The URL should really be something like
52 ;; gnats:database/pr-number however, I'm not yet certian how to
53 ;; handle all the possible variations to setup the correct server, for
54 ;; instance, port number, user name, password. The password could then
55 ;; get tricky, because what if the text file is stored in an unsecure
58 ;; So, right now this assumes your gnats is already setup for the
59 ;; correct server, which will be the case for probably 90% of the
68 (defun planner-gnats-annotation-from-gnats ()
69 "If called from gnats-edit or gnats-view buffer, return an annotation.
70 Suitable for use in `planner-annotation-functions'."
71 (when (string-match "^\\*gnats-\\(edit\\|\\view\\)-\\(.+\\)\\*"
73 (let ((pr-num (match-string 2 (buffer-name))))
75 (concat "gnats:" pr-num
)
76 (concat "Gnats Bug: " pr-num
)
80 (defun planner-gnats-browse-url (url)
81 "If this is a Gnats URL, view the pr (view-pr)."
82 (when (string-match "\\`gnats:/*\\(.+\\)" url
)
83 (let ((pr-num (match-string 1 url
)))
84 (view-pr (string-to-number pr-num
)))
87 (planner-add-protocol "gnats:/*" 'planner-gnats-browse-url nil
)
88 (custom-add-option 'planner-annotation-functions
89 'planner-gnats-annotation-from-gnats
)
90 (add-hook 'planner-annotation-functions
'planner-gnats-annotation-from-gnats
)
92 (provide 'planner-gnats
)
94 ;;; planner-gnats.el ends here