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 site maintaining mailing list for GNU Emacs bugs.")
43 (defvar report-emacs-bug-orig-text nil
44 "The automatically-created initial text of bug report.")
47 (defun report-emacs-bug (topic)
48 "Report a bug in GNU Emacs.
49 Prompts for bug subject. Leaves you in a mail buffer."
50 (interactive "sBug Subject: ")
51 (if (mail nil bug-gnu-emacs topic)
53 ;; The rest of this does not execute
54 ;; if the user was asked to confirm and said no.
55 (goto-char (point-min))
56 (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n"))
57 (insert "In " (emacs-version) "\n")
58 (if (and system-configuration-options
59 (not (equal system-configuration-options "")))
60 (insert "configured using `configure "
61 system-configuration-options "'\n"))
63 (insert "Please describe exactly what actions triggered the bug\n"
64 "and the precise symptoms of the bug:\n\n")
65 (setq user-point (point))
68 (let ((before-keys (point)))
69 (insert (mapconcat (lambda (key)
70 (if (or (integerp key)
73 (single-key-description key)
74 (prin1-to-string key nil)))
78 (narrow-to-region before-keys (point))
79 (goto-char before-keys)
80 (while (progn (move-to-column 50) (not (eobp)))
81 (search-forward " " nil t)
83 (let ((message-buf (get-buffer "*Messages*")))
86 (insert "\n\nRecent messages:\n")
87 (insert-buffer-substring message-buf
89 (set-buffer message-buf)
90 (goto-char (point-max))
94 (set-buffer message-buf)
96 ;; This is so the user has to type something
97 ;; in order to send easily.
98 (use-local-map (nconc (make-sparse-keymap) (current-local-map)))
99 (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info)
100 (with-output-to-temp-buffer "*Bug Help*"
101 (princ (substitute-command-keys
102 "Type \\[mail-send-and-exit] to send the bug report.\n"))
103 (princ (substitute-command-keys
104 "Type \\[kill-buffer] RET to cancel (don't send it).\n"))
106 (princ (substitute-command-keys
107 "Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section
108 about when and how to write a bug report,
109 and what information to supply so that the bug can be fixed.
110 Type SPC to scroll through this section and its subsections.")))
111 ;; Make it less likely people will send empty messages.
112 (make-local-variable 'mail-send-hook)
113 (add-hook 'mail-send-hook 'report-emacs-bug-hook)
115 (goto-char (point-max))
116 (skip-chars-backward " \t\n")
117 (make-local-variable 'report-emacs-bug-orig-text)
118 (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point))))
119 (goto-char user-point))))
121 (defun report-emacs-bug-info ()
122 "Go to the Info node on reporting Emacs bugs."
127 (Info-goto-node "Bugs"))
129 (defun report-emacs-bug-hook ()
131 (goto-char (point-max))
132 (skip-chars-backward " \t\n")
133 (if (and (= (- (point) (point-min))
134 (length report-emacs-bug-orig-text))
135 (equal (buffer-substring (point-min) (point))
136 report-emacs-bug-orig-text))
137 (error "No text entered in bug report"))))
141 ;;; emacsbug.el ends here