summaryrefslogtreecommitdiff
path: root/gnus-BTS.el
diff options
context:
space:
mode:
authorlolando <>2003-04-04 20:16:18 +0000
committerlolando <>2003-04-04 20:16:18 +0000
commiteb170c2cd68d043f38145712222e87b2f8540bb0 (patch)
tree44aa291646a6af60d053585fb2e5d2391eae3869 /gnus-BTS.el
Initial import, based on version 19.2-1 currently in unstable.
Diffstat (limited to 'gnus-BTS.el')
-rw-r--r--gnus-BTS.el124
1 files changed, 124 insertions, 0 deletions
diff --git a/gnus-BTS.el b/gnus-BTS.el
new file mode 100644
index 0000000..d5eb960
--- /dev/null
+++ b/gnus-BTS.el
@@ -0,0 +1,124 @@
+;;; gnus-BTS.el --- access the Debian Bug Tracking System from Gnus
+
+;; Copyright (C) 2001 Andreas Fuchs <asf@acm.org>
+
+;; Author: Andreas Fuchs
+;; Maintainer: Andreas Fuchs <asf@acm.org>
+;; Keywords: gnus, Debian, Bug
+;; Status: Works in XEmacs (I think >=21)
+;; Created: 2001-02-07
+
+;; $Id$
+
+;; This file is not part of GNU Emacs.
+
+;; gnus-BTS.el is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; gnus-BTS.el is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; Use this program if you read a lot of debian lists and see many
+;; references to the Bug Tracking system in them. It expects to see
+;; Bug references in the form of (for example): "#48273", "closes:
+;; 238742" or similar.
+
+;;; Code:
+
+
+(setq anti-bug-special-keywords "reassign\\|merge")
+(setq anti-bug-keywords (concat
+ "tags\\|severity\\|retitle\\|close\\|closes:\\|Merged\\|reopen\\|Bug\\|"
+ anti-bug-special-keywords))
+
+(setq anti-bug-prefix " *#?\\|Bugs?\\|#")
+(setq anti-bug-number " *\\([0-9]+\\)")
+(setq anti-bug-special " +\\([0-9]+\\|[-.A-Za-z0-9]+\\)")
+
+(setq anti-gnus-debian-bug-regexp (concat
+ "\\("
+ "\\("
+ anti-bug-keywords
+ "\\)"
+ anti-bug-prefix
+ "\\)"
+ anti-bug-number))
+
+(setq anti-gnus-debian-reassign-or-merge-regexp
+ (concat
+ "\\("
+ anti-bug-special-keywords
+ "\\)"
+ anti-bug-number
+ anti-bug-special))
+
+(setq anti-gnus-debian-reassign-regexp "reassigned from package `\\([^']*\\)' to `\\([^']*\\)'")
+(setq anti-gnus-debian-bug-BTS-regexp "^ *\\([0-9]+\\)")
+
+(defun anti-browse-debpkg-or-bug (thing)
+ (interactive "i")
+ (require 'thingatpt)
+ (let* ((the-thing (if (null thing)
+ (thing-at-point 'sexp)
+ thing))
+ (bugp (string-match "[0-9]+$" the-thing))
+ (bug-or-feature (if bugp
+ (progn
+ (string-match "^[^0-9]*\\([0-9]+\\)$" the-thing)
+ (match-string 1 the-thing))
+ the-thing))
+ (url (if bugp
+ "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug="
+ "http://cgi.debian.org/cgi-bin/search_packages.pl?&searchon=names&version=all&release=all&keywords=")))
+ (browse-url (concat url bug-or-feature))))
+
+(defvar in-debian-group-p nil)
+(add-hook 'gnus-select-article-hook
+ (lambda ()
+ (setq in-debian-group-p (string-match "debian"
+ (gnus-group-real-name
+ gnus-newsgroup-name)))))
+
+(defvar in-debian-devel-announce-group-p nil)
+(add-hook 'gnus-select-article-hook
+ (lambda ()
+ (setq in-debian-devel-announce-group-p
+ (string-match "debian.devel.announce"
+ (gnus-group-real-name
+ gnus-newsgroup-name)))))
+
+(defun anti-buttonize-debian (regexp num predicate)
+ (add-to-list 'gnus-button-alist
+ (list regexp
+ num
+ predicate
+ 'anti-browse-debpkg-or-bug
+ num)))
+
+(add-hook
+ 'gnus-article-mode-hook ; only run once, as soon as the article buffer has been created.
+ (lambda ()
+ (anti-buttonize-debian anti-gnus-debian-bug-regexp 3
+ 'in-debian-group-p)
+ (anti-buttonize-debian anti-gnus-debian-reassign-or-merge-regexp 3
+ 'in-debian-group-p)
+ (anti-buttonize-debian anti-gnus-debian-bug-BTS-regexp 1
+ 'in-debian-devel-announce-group-p)
+
+ (anti-buttonize-debian anti-gnus-debian-reassign-regexp 1
+ 'in-debian-group-p)
+ (anti-buttonize-debian anti-gnus-debian-reassign-regexp 2
+ 'in-debian-group-p)))
+
+(provide 'gnus-BTS)