blob: 55821e5e6c5c00dffa11928361d6ef79b3131edb [file] [log] [blame]
;;; gccbug.el --- forward bug reports to gnats
;; (C) 2000 Free Software Foundation
;; Written by Martin v. Löwis
;; Usage:
;; In rmail, bind a key to rmail-gccbug-reply, e.g.
;; (require 'rmail)
;; (require 'gccbug)
;; (define-key rmail-mode-map "R" 'rmail-gccbug-reply)
;; Then, when reviewing a report, type R to create a gnats-formatted
;; message.
(provide 'gccbug)
(defun gccbug-reply ()
(let ((orig-yank-prefix mail-yank-prefix))
(insert ">Submitter-Id: net\n")
(insert ">Originator: \n")
(insert ">Confidential: no\n")
(insert ">Synopsis: ")
(let ((stop (point)))
(re-search-backward "Re: ")
(copy-region-as-kill (match-end 0) stop)))
(insert "\n")
(insert ">Severity: serious\n")
(insert ">Priority: medium\n")
(insert ">Category: \n")
(insert ">Class: \n")
;(insert ">State: analyzed\n")
(insert ">Release: 2.95.2\n")
(insert ">Environment:\n")
(insert ">Description:\n")
(set 'mail-yank-prefix nil)
(set 'mail-yank-ignored-headers
(mail-yank-original t)
(set 'mail-yank-prefix orig-yank-prefix)
; Copy From: field to Originator:
(re-search-backward "From: ")
(let ((beg (match-end 0)))
(kill-region beg (point)))
(re-search-backward ">Originator: ")
(goto-char (match-end 0))
; Kill From: line
(re-search-forward "From:")
(kill-line 1)
; Replace Message-ID: with Original-Message-ID
(re-search-forward "Message-ID: .*")
(replace-match "Original-\\&")
; Replace To: line, adding recipient to Notify list
(re-search-backward "To: ")
(replace-match "To:\nX-GNATS-Notify: ")
; add additional fields
(insert ">How-To-Repeat: \n>Fix: \n")
; See whether an Organization: is present
(let ((org (re-search-backward "Organization:.*" nil t)))
(if org
(kill-region (point) (match-end 0))
(re-search-backward ">Confidential")
(insert ">")
(insert "\n"))))
; This kills CC: lines, but rmail-reply below won't create any
; (mail-cc)
; (beginning-of-line)
; (kill-line 1)
(defun rmail-gccbug-reply ()
(rmail-toggle-header 0)
(rmail-reply t)