annotate lisp/mail/reporter.el @ 4703:c5419d943526

Initial revision
author Roland McGrath <roland@gnu.org>
date Sun, 12 Sep 1993 10:45:13 +0000
parents a1a2b1ee2554
children 4df93ff816c4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; reporter.el --- customizable bug reporting of lisp programs
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
2 ;; Copyright (C) 1993 Free Software Foundation, Inc.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;; Author: 1993 Barry A. Warsaw, Century Computing Inc. <bwarsaw@cen.com>
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Maintainer: bwarsaw@cen.com
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Created: 19-Apr-1993
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: bug reports lisp
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is not yet part of GNU Emacs.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; This program is free software; you can redistribute it and/or modify
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2 of the License, or
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; (at your option) any later version.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; This program is distributed in the hope that it will be useful,
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with this program; if not, write to the Free Software
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; Introduction
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; ============
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; This program is for lisp package authors and is used to ease
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; reporting of bugs. When invoked, reporter-submit-bug-report will
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; set up a mail buffer with the appropriate bug report address,
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; including a lisp expression the maintainer of the package can use
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; to completely reproduce the environment in which the bug was
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; observed (e.g. by using eval-last-sexp). This package is especially
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; useful for my development of c++-mode.el, which is highly dependent
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; on its configuration variables.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; Do a "C-h f reporter-submit-bug-report" for more information.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; Here's an example usage:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; (defconst mypkg-version "9.801")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; (defconst mypkg-maintainer-address "mypkg-help@foo.com")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; (defun mypkg-submit-bug-report ()
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; "Submit via mail a bug report on mypkg"
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; (interactive)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; (require 'reporter)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; (and (y-or-n-p "Do you really want to submit a report on mypkg? ")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; (reporter-submit-bug-report
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; mypkg-maintainer-address
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; (concat "mypkg.el " mypkg-version)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; (list 'mypkg-variable-1
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; 'mypkg-variable-2
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; ;; ...
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; 'mypkg-variable-last))))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; Mailing List
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; ============
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; I've set up a mailing list to report bugs or suggest enhancements,
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; etc. This list's intended audience is elisp package authors who are
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;; using reporter and want to stay current with releases. Here are the
3589
6af3ae2976d0 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 3421
diff changeset
59 ;; relevant addresses:
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; Administrivia: reporter-request@anthem.nlm.nih.gov
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; Submissions: reporter@anthem.nlm.nih.gov
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; LCD Archive Entry:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; reporter|Barry A. Warsaw|warsaw@cen.com|
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; Customizable bug reporting of lisp programs.|
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; 1993/05/22 00:29:49|1.18|~/misc/reporter.el.Z|
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;;; Code:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; user defined variables
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 (defvar reporter-mailer 'mail
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 "*Mail package to use to generate bug report buffer.")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;; end of user defined variables
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
81 (defvar reporter-eval-buffer nil
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
82 "Buffer to retrieve variable's value from.
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
83 This is necessary to properly support the printing of buffer-local
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
84 variables. Current buffer will always be the mail buffer being
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
85 composed.")
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (defun reporter-dump-variable (varsym)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 "Pretty-print the value of the variable in symbol VARSYM."
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
89 (let ((val (save-excursion
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
90 (set-buffer reporter-eval-buffer)
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
91 (eval varsym)))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (sym (symbol-name varsym))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (print-escape-newlines t))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (insert " " sym " "
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (cond
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 ((memq val '(t nil)) "")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ((listp val) "'")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 ((symbolp val) "'")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (t ""))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (prin1-to-string val)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 "\n")))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (defun reporter-dump-state (pkgname varlist pre-hooks post-hooks)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 "Dump the state of the mode specific variables.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 PKGNAME contains the name of the mode as it will appear in the bug
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 report (you must explicitly concat any version numbers).
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 VARLIST is the list of variables to dump. Each element in VARLIST can
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 be a variable symbol, or a cons cell. If a symbol, this will be
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 passed to `reporter-dump-variable' for insertion into the mail buffer.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 If a cons cell, the car must be a variable symbol and the cdr must be
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 a function which will be `funcall'd with the symbol. Use this to write
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 your own custom variable value printers for specific variables.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
115 Note that the global variable `reporter-eval-buffer' will be bound to
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
116 the buffer in which `reporter-submit-bug-report' was invoked. If you
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
117 want to print the value of a buffer local variable, you should wrap
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
118 the `eval' call in your custom printer inside a `set-buffer' (and
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
119 probably a `save-excursion'). `reporter-dump-variable' handles this
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
120 properly.
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
121
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 PRE-HOOKS is run after the emacs-version and PKGNAME are inserted, but
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 before the VARLIST is dumped. POST-HOOKS is run after the VARLIST is
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 dumped."
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (let ((buffer (current-buffer)))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (set-buffer buffer)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (insert "Emacs : " (emacs-version) "\nPackage: " pkgname "\n")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (run-hooks 'pre-hooks)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (insert "\ncurrent state:\n==============\n(setq\n")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (mapcar
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (function
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (lambda (varsym-or-cons-cell)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (let ((varsym (or (car-safe varsym-or-cons-cell)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 varsym-or-cons-cell))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (printer (or (cdr-safe varsym-or-cons-cell)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 'reporter-dump-variable)))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 (funcall printer varsym)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 )))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 varlist)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (insert " )\n")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (run-hooks 'post-hooks)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 ))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (defun reporter-submit-bug-report
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (address pkgname varlist &optional pre-hooks post-hooks salutation)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 "Submit a bug report via mail.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 ADDRESS is the email address for the package's maintainer. PKGNAME is
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 the name of the mode (you must explicitly concat any version numbers).
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 VARLIST is the list of variables to dump (do a `\\[describe-function] reporter-dump-state'
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 for details). Optional PRE-HOOKS and POST-HOOKS are passed to
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 `reporter-dump-state'. Optional SALUTATION is inserted at the top of the
3589
6af3ae2976d0 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 3421
diff changeset
153 mail buffer, and point is left after the salutation.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 The mailer used is described in the variable `reporter-mailer'."
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
157 (let ((reporter-eval-buffer (current-buffer))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (mailbuf (progn (call-interactively reporter-mailer)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (current-buffer))))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (require 'sendmail)
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
161 (pop-to-buffer reporter-eval-buffer)
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (pop-to-buffer mailbuf)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (goto-char (point-min))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 ;; different mailers use different separators, some may not even
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 ;; use m-h-s, but sendmail.el stuff must have m-h-s bound.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (let ((mail-header-separator
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (save-excursion
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (re-search-forward
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (concat
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 "^\\(" ;beginning of line
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (mapconcat
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 'identity
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (list "[\t ]*" ;simple SMTP form
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 "-+" ;mh-e form
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 (regexp-quote
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 mail-header-separator)) ;sendmail.el form
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 "\\|") ;or them together
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 "\\)$") ;end of line
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 nil
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 'move) ;search for and move
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (buffer-substring (match-beginning 0) (match-end 0)))))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (mail-position-on-field "to")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (insert address)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 (mail-position-on-field "subject")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (insert "Report on package " pkgname)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 (re-search-forward mail-header-separator (point-max) 'move)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (forward-line 1)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 (and salutation (insert "\n" salutation "\n\n"))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (set-mark (point)) ;user should see mark change
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (insert "\n\n")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 (reporter-dump-state pkgname varlist pre-hooks post-hooks)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 (exchange-point-and-mark))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 (let* ((sendkey "C-c C-c") ;can this be generalized like below?
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (killkey-whereis (where-is-internal 'kill-buffer nil t))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (killkey (if killkey-whereis
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (key-description killkey-whereis)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 "M-x kill-buffer")))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (message "Please type in your report. Hit %s to send, %s to abort."
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 sendkey killkey))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 ))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 ;; this is useful
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 (provide 'reporter)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 ;;; reporter.el ends here