1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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)
|