1 ;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list.
3 ;; Copyright (C) 1985, 1994 Free Software Foundation, Inc.
5 ;; Author: K. Shane Hartman
9 ;; Not fully installed because it can work only on Internet hosts.
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 ;; `M-x report-emacs-bug ' starts an email note to the Emacs maintainers
30 ;; describing a problem. Here's how it's done...
34 ;; >> This should be an address which is accessible to your machine,
35 ;; >> otherwise you can't use this file. It will only work on the
36 ;; >> internet with this address.
40 (defvar bug-gnu-emacs "bug-gnu-emacs@prep.ai.mit.edu"
41 "Address of mailing list for GNU Emacs bugs.")
43 (defvar report-emacs-bug-pretest-address "emacs-pretest-bug@gnu.ai.mit.edu"
44 "Address of mailing list for GNU Emacs pretest bugs.")
46 (defvar report-emacs-bug-orig-text nil
47 "The automatically-created initial text of bug report.")
50 (defun report-emacs-bug (topic &optional recent-keys)
51 "Report a bug in GNU Emacs.
52 Prompts for bug subject. Leaves you in a mail buffer."
53 ;; This strange form ensures that (recent-keys) is the value before
54 ;; the bug subject string is read.
55 (interactive (reverse (list (recent-keys) (read-string "Bug Subject: "))))
58 (compose-mail (if (string-match "\\..*\\..*\\." emacs-version)
59 ;; If there are four numbers in emacs-version,
60 ;; this is a pretest version.
61 report-emacs-bug-pretest-address
64 ;; The rest of this does not execute
65 ;; if the user was asked to confirm and said no.
66 (goto-char (point-min))
67 (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n"))
68 (insert "In " (emacs-version) "\n")
69 (if (and system-configuration-options
70 (not (equal system-configuration-options "")))
71 (insert "configured using `configure "
72 system-configuration-options "'\n"))
74 (insert "Please describe exactly what actions triggered the bug\n"
75 "and the precise symptoms of the bug:\n\n")
76 (setq user-point (point))
79 (let ((before-keys (point)))
80 (insert (mapconcat (lambda (key)
81 (if (or (integerp key)
84 (single-key-description key)
85 (prin1-to-string key nil)))
86 (or recent-keys (recent-keys))
89 (narrow-to-region before-keys (point))
90 (goto-char before-keys)
91 (while (progn (move-to-column 50) (not (eobp)))
92 (search-forward " " nil t)
94 (let ((message-buf (get-buffer "*Messages*")))
97 (insert "\n\nRecent messages:\n")
98 (insert-buffer-substring message-buf
100 (set-buffer message-buf)
101 (goto-char (point-max))
105 (set-buffer message-buf)
107 ;; This is so the user has to type something
108 ;; in order to send easily.
109 (use-local-map (nconc (make-sparse-keymap) (current-local-map)))
110 (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info)
111 (with-output-to-temp-buffer "*Bug Help*"
112 (princ (substitute-command-keys
113 "Type \\[mail-send-and-exit] to send the bug report.\n"))
114 (princ (substitute-command-keys
115 "Type \\[kill-buffer] RET to cancel (don't send it).\n"))
117 (princ (substitute-command-keys
118 "Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section
119 about when and how to write a bug report,
120 and what information to supply so that the bug can be fixed.
121 Type SPC to scroll through this section and its subsections.")))
122 ;; Make it less likely people will send empty messages.
123 (make-local-variable 'mail-send-hook)
124 (add-hook 'mail-send-hook 'report-emacs-bug-hook)
126 (goto-char (point-max))
127 (skip-chars-backward " \t\n")
128 (make-local-variable 'report-emacs-bug-orig-text)
129 (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point))))
130 (goto-char user-point))
133 (defun report-emacs-bug-info ()
134 "Go to the Info node on reporting Emacs bugs."
139 (Info-goto-node "Bugs"))
141 (defun report-emacs-bug-hook ()
143 (goto-char (point-max))
144 (skip-chars-backward " \t\n")
145 (if (and (= (- (point) (point-min))
146 (length report-emacs-bug-orig-text))
147 (equal (buffer-substring (point-min) (point))
148 report-emacs-bug-orig-text))
149 (error "No text entered in bug report"))))
153 ;;; emacsbug.el ends here