planner-el.texi (Keeping Track of Time): Recover paragraph that had
[planner-el.git] / planner-gnats.el
blob5b2ebf70bea47b806a48875a43df1a65992fd785
1 ;;; planner-gnats.el --- GNATS integration for the Emacs Planner
3 ;; Copyright (C) 2005, 2008 Jeremy Cowgar (jeremy AT cowgar DOT com)
5 ;; Author: Jeremy Cowgar (jeremy AT cowgar DOT com)
6 ;; Keywords: planner, gnats
7 ;; URL: http://www.wjsullivan.net/PlannerMode.html
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 3, or (at your option)
15 ;; any later version.
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.
27 ;;; Commentary:
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.
34 ;; Add
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
49 ;;; Todo::
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
56 ;; manner?
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
60 ;; users.
62 ;;; Code:
64 (require 'planner)
65 (require 'gnats)
67 ;;;###autoload
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\\)-\\(.+\\)\\*"
72 (buffer-name))
73 (let ((pr-num (match-string 2 (buffer-name))))
74 (planner-make-link
75 (concat "gnats:" pr-num)
76 (concat "Gnats Bug: " pr-num)
77 t))))
79 ;;;###autoload
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)))
85 t))
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