Daily bump.
[official-gcc.git] / contrib / gccbug.el
blob55821e5e6c5c00dffa11928361d6ef79b3131edb
1 ;;; gccbug.el --- forward bug reports to gnats
2 ;; (C) 2000 Free Software Foundation
3 ;; Written by Martin v. Löwis
4 ;; Usage:
5 ;; In rmail, bind a key to rmail-gccbug-reply, e.g.
6 ;; (require 'rmail)
7 ;; (require 'gccbug)
8 ;; (define-key rmail-mode-map "R" 'rmail-gccbug-reply)
9 ;; Then, when reviewing a report, type R to create a gnats-formatted
10 ;; message.
12 (provide 'gccbug)
14 (defun gccbug-reply ()
15 (interactive)
16 (let ((orig-yank-prefix mail-yank-prefix))
17 (insert ">Submitter-Id: net\n")
18 (insert ">Originator: \n")
19 (insert ">Confidential: no\n")
20 (insert ">Synopsis: ")
21 (save-excursion
22 (mail-subject)
23 (let ((stop (point)))
24 (re-search-backward "Re: ")
25 (copy-region-as-kill (match-end 0) stop)))
26 (yank)
27 (insert "\n")
28 (insert ">Severity: serious\n")
29 (insert ">Priority: medium\n")
30 (insert ">Category: \n")
31 (insert ">Class: \n")
32 ;(insert ">State: analyzed\n")
33 (insert ">Release: 2.95.2\n")
34 (insert ">Environment:\n")
35 (insert ">Description:\n")
36 (set 'mail-yank-prefix nil)
37 (set 'mail-yank-ignored-headers
38 "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^remailed\\|^received:\\|^summary-line:\\|^to:\\|^subject:\\|^in-reply-to:\\|^return-path:\\|^X-.*:\\|^User-Agent:\\|^MIME-Version:\\|^Content-.*:\\|^List-.*:\\|C[Cc]:\\|^Precedence:\\|^Sender:\\|^Mailing-List:\\|^Delivered-To:\\|^>From")
39 (mail-yank-original t)
40 (set 'mail-yank-prefix orig-yank-prefix)
41 ; Copy From: field to Originator:
42 (re-search-backward "From: ")
43 (let ((beg (match-end 0)))
44 (end-of-line)
45 (kill-region beg (point)))
46 (re-search-backward ">Originator: ")
47 (goto-char (match-end 0))
48 (yank)
49 ; Kill From: line
50 (re-search-forward "From:")
51 (beginning-of-line)
52 (kill-line 1)
53 ; Replace Message-ID: with Original-Message-ID
54 (beginning-of-buffer)
55 (re-search-forward "Message-ID: .*")
56 (replace-match "Original-\\&")
57 ; Replace To: line, adding recipient to Notify list
58 (mail-to)
59 (re-search-backward "To: ")
60 (replace-match "To: gcc-gnats@gcc.gnu.org\nX-GNATS-Notify: ")
61 ; add additional fields
62 (end-of-buffer)
63 (insert ">How-To-Repeat: \n>Fix: \n")
64 ; See whether an Organization: is present
65 (let ((org (re-search-backward "Organization:.*" nil t)))
66 (if org
67 (progn
68 (kill-region (point) (match-end 0))
69 (re-search-backward ">Confidential")
70 (insert ">")
71 (yank)
72 (insert "\n"))))
73 ; This kills CC: lines, but rmail-reply below won't create any
74 ; (mail-cc)
75 ; (beginning-of-line)
76 ; (kill-line 1)
79 (defun rmail-gccbug-reply ()
80 (interactive)
81 (rmail-toggle-header 0)
82 (rmail-reply t)
83 (gccbug-reply))