annotate lisp/mail/reporter.el @ 13678:7d9570072e6c libc-951201 libc-951202 libc-951203 libc-951204

* config.guess: Recognize Pentium under SCO.
author Per Bothner <bothner@cygnus.com>
date Thu, 30 Nov 1995 21:59:48 +0000
parents fd0a461e9c72
children 7709c74b3188
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
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
3 ;; Author: 1993 Barry A. Warsaw <bwarsaw@cnri.reston.va.us>
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
4 ;; Maintainer: bwarsaw@cnri.reston.va.us
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Created: 19-Apr-1993
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
6 ;; Version: 2.21
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
7 ;; Last Modified: 1994/11/29 16:13:50
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
8 ;; Keywords: bug reports lisp
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
10 ;; Copyright (C) 1993 1994 Barry A. Warsaw
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
11 ;; Copyright (C) 1993 1994 Free Software Foundation, Inc.
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
12
4839
4df93ff816c4 fix comment
David J. MacKenzie <djm@gnu.org>
parents: 3903
diff changeset
13 ;; This file is part of GNU Emacs.
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
14
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; it under the terms of the GNU General Public License as published by
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
17 ;; the Free Software Foundation; either version 2, or (at your option)
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
18 ;; any later version.
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
19
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
20 ;; GNU Emacs is distributed in the hope that it will be useful,
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; GNU General Public License for more details.
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
24
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, write to
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
27 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
29 ;;; Commentary:
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
30 ;;
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; Introduction
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; ============
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
33 ;; This program is for lisp package authors and can be used to ease
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; reporting of bugs. When invoked, reporter-submit-bug-report will
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; set up a mail buffer with the appropriate bug report address,
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
36 ;; including a lisp expression the maintainer of the package can eval
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; to completely reproduce the environment in which the bug was
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
38 ;; observed (e.g. by using eval-last-sexp). This package proved
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
39 ;; especially useful during my development of cc-mode.el, which is
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
40 ;; highly dependent on its configuration variables.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; Do a "C-h f reporter-submit-bug-report" for more information.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; Here's an example usage:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;;
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
45 ;;(defconst mypkg-version "9.801")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
46 ;;(defconst mypkg-maintainer-address "mypkg-help@foo.com")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
47 ;;(defun mypkg-submit-bug-report ()
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
48 ;; "Submit via mail a bug report on mypkg"
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
49 ;; (interactive)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
50 ;; (require 'reporter)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
51 ;; (reporter-submit-bug-report
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
52 ;; mypkg-maintainer-address
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
53 ;; (concat "mypkg.el " mypkg-version)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
54 ;; (list 'mypkg-variable-1
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
55 ;; 'mypkg-variable-2
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
56 ;; ;; ...
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
57 ;; 'mypkg-variable-last)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
58
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; Mailing List
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 ;; 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
62 ;; etc. This list's intended audience is elisp package authors who are
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 ;; using reporter and want to stay current with releases. Here are the
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
64 ;; relevent addresses:
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; Administrivia: reporter-request@anthem.nlm.nih.gov
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; Submissions: reporter@anthem.nlm.nih.gov
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
69 ;; Packages that currently use reporter are: cc-mode, supercite, elp,
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
70 ;; tcl, ediff, crypt, vm, edebug, archie, and efs. If you know of
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
71 ;; others, please email me!
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
72
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; LCD Archive Entry:
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
74 ;; reporter|Barry A. Warsaw|bwarsaw@cnri.reston.va.us|
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; Customizable bug reporting of lisp programs.|
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
76 ;; 1994/11/29 16:13:50|2.21|~/misc/reporter.el.Z|
3421
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 ;;; Code:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;; user defined variables
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83
11422
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
84 (defvar reporter-mailer '(vm-mail reporter-mail)
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
85 "*Mail package to use to generate bug report buffer.
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
86 This can either be a function symbol or a list of function symbols.
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
87 If a list, it tries to use each specified mailer in order until an
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
88 existing one is found.
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
89
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
90 MH-E users may want to use `mh-smail'.")
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
91
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
92 (defvar reporter-prompt-for-summary-p nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
93 "Interface variable controlling prompting for problem summary.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
94 When non-nil, `reporter-submit-bug-report' prompts the user for a
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
95 brief summary of the problem, and puts this summary on the Subject:
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
96 line.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
97
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
98 Default behavior is to not prompt (i.e. nil). If you want reporter to
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
99 prompt, you should `let' bind this variable to t before calling
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
100 `reporter-submit-bug-report'. Note that this variable is not
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
101 buffer-local so you should never just `setq' it.")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
102
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
103 (defvar reporter-dont-compact-list nil
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
104 "Interface variable controlling compating of list values.
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
105 When non-nil, this must be a list of variable symbols. When a
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
106 variable containing a list value is formatted in the bug report mail
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
107 buffer, it normally is compacted so that its value fits one the fewest
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
108 number of lines. If the variable's symbol appears in this list, its
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
109 value is printed in a more verbose style, specifically, one elemental
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
110 sexp per line.
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
111
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
112 Note that this variable is not buffer-local so you should never just
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
113 `setq' it. If you want to changes its default value, you should `let'
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
114 bind it.")
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ;; end of user defined variables
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
119 (defvar reporter-eval-buffer nil
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
120 "Buffer to retrieve variable's value from.
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
121 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
122 variables. Current buffer will always be the mail buffer being
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
123 composed.")
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
124
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
125 (defconst reporter-version "2.21"
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
126 "Reporter version number.")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
127
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
128 (defvar reporter-initial-text nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
129 "The automatically created initial text of a bug report.")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
130 (make-variable-buffer-local 'reporter-initial-text)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
131
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
132
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
133 (defvar reporter-status-message nil)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
134 (defvar reporter-status-count nil)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
135
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
136 (defun reporter-update-status ()
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
137 ;; periodically output a status message
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
138 (if (zerop (% reporter-status-count 10))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
139 (progn
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
140 (message reporter-status-message)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
141 (setq reporter-status-message (concat reporter-status-message "."))))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
142 (setq reporter-status-count (1+ reporter-status-count)))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
143
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
145 (defun reporter-beautify-list (maxwidth compact-p)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
146 ;; pretty print a list
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
147 (reporter-update-status)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
148 (let (linebreak indent-enclosing-p indent-p here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
149 (condition-case nil ;loop exit
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
150 (progn
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
151 (down-list 1)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
152 (setq indent-enclosing-p t)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
153 (while t
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
154 (setq here (point))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
155 (forward-sexp 1)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
156 (if (<= maxwidth (current-column))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
157 (if linebreak
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
158 (progn
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
159 (goto-char linebreak)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
160 (newline-and-indent)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
161 (setq linebreak nil))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
162 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
163 (setq indent-p (reporter-beautify-list maxwidth compact-p))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
164 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
165 (forward-sexp 1)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
166 (if indent-p
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
167 (newline-and-indent))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
168 t)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
169 (if compact-p
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
170 (setq linebreak (point))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
171 (newline-and-indent))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
172 ))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
173 t)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
174 (error indent-enclosing-p))))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
175
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
176 (defun reporter-lisp-indent (indent-point state)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
177 ;; a better lisp indentation style for bug reporting
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
178 (save-excursion
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
179 (goto-char (1+ (nth 1 state)))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
180 (current-column)))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
181
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
182 (defun reporter-dump-variable (varsym mailbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
183 ;; Pretty-print the value of the variable in symbol VARSYM. MAILBUF
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
184 ;; is the mail buffer being composed
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
185 (reporter-update-status)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
186 (condition-case nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
187 (let ((val (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
188 (set-buffer reporter-eval-buffer)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
189 (symbol-value varsym)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
190 (sym (symbol-name varsym))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
191 (print-escape-newlines t)
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
192 (maxwidth (1- (window-width)))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
193 (here (point)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
194 (insert " " sym " "
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
195 (cond
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
196 ((memq val '(t nil)) "")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
197 ((listp val) "'")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
198 ((symbolp val) "'")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
199 (t ""))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
200 (prin1-to-string val))
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
201 (lisp-indent-line)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
202 ;; clean up lists, but only if the line as printed was long
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
203 ;; enough to wrap
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
204 (if (and val ;nil is a list, but short
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
205 (listp val)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
206 (<= maxwidth (current-column)))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
207 (save-excursion
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
208 (let ((compact-p (not (memq varsym reporter-dont-compact-list)))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
209 (lisp-indent-function 'reporter-lisp-indent))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
210 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
211 (reporter-beautify-list maxwidth compact-p))))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
212 (insert "\n"))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
213 (void-variable
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
214 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
215 (set-buffer mailbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
216 (mail-position-on-field "X-Reporter-Void-Vars-Found")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
217 (end-of-line)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
218 (insert (symbol-name varsym) " ")))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
219 (error (error))))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 (defun reporter-dump-state (pkgname varlist pre-hooks post-hooks)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
222 ;; Dump the state of the mode specific variables.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
223 ;; PKGNAME contains the name of the mode as it will appear in the bug
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
224 ;; report (you must explicitly concat any version numbers).
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
226 ;; VARLIST is the list of variables to dump. Each element in
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
227 ;; VARLIST can be a variable symbol, or a cons cell. If a symbol,
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
228 ;; this will be passed to `reporter-dump-variable' for insertion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
229 ;; into the mail buffer. If a cons cell, the car must be a variable
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
230 ;; symbol and the cdr must be a function which will be `funcall'd
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
231 ;; with arguments the symbol and the mail buffer being composed. Use
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
232 ;; this to write your own custom variable value printers for
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
233 ;; specific variables.
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
234
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
235 ;; Note that the global variable `reporter-eval-buffer' will be bound to
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
236 ;; the buffer in which `reporter-submit-bug-report' was invoked. If you
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
237 ;; want to print the value of a buffer local variable, you should wrap
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
238 ;; the `eval' call in your custom printer inside a `set-buffer' (and
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
239 ;; probably a `save-excursion'). `reporter-dump-variable' handles this
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
240 ;; properly.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
241
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
242 ;; PRE-HOOKS is run after the emacs-version and PKGNAME are inserted, but
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
243 ;; before the VARLIST is dumped. POST-HOOKS is run after the VARLIST is
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
244 ;; dumped.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (let ((buffer (current-buffer)))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 (set-buffer buffer)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
247 (insert "Emacs : " (emacs-version) "\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
248 (and pkgname
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
249 (insert "Package: " pkgname "\n"))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 (run-hooks 'pre-hooks)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
251 (if (not varlist)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
252 nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
253 (insert "\ncurrent state:\n==============\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
254 ;; create an emacs-lisp-mode buffer to contain the output, which
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
255 ;; we'll later insert into the mail buffer
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
256 (condition-case fault
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
257 (let ((mailbuf (current-buffer))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
258 (elbuf (get-buffer-create " *tmp-reporter-buffer*")))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
259 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
260 (set-buffer elbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
261 (emacs-lisp-mode)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
262 (erase-buffer)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
263 (insert "(setq\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
264 (lisp-indent-line)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
265 (mapcar
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
266 (function
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
267 (lambda (varsym-or-cons-cell)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
268 (let ((varsym (or (car-safe varsym-or-cons-cell)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
269 varsym-or-cons-cell))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
270 (printer (or (cdr-safe varsym-or-cons-cell)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
271 'reporter-dump-variable)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
272 (funcall printer varsym mailbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
273 )))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
274 varlist)
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
275 (lisp-indent-line)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
276 (insert ")\n"))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
277 (insert-buffer elbuf))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
278 (error
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
279 (insert "State could not be dumped due to the following error:\n\n"
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
280 (format "%s" fault)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
281 "\n\nYou should still send this bug report."))))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (run-hooks 'post-hooks)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 ))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
285
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
286 (defun reporter-calculate-separator ()
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
287 ;; returns the string regexp matching the mail separator
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
288 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
289 (re-search-forward
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
290 (concat
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
291 "^\\(" ;beginning of line
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
292 (mapconcat
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
293 'identity
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
294 (list "[\t ]*" ;simple SMTP form
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
295 "-+" ;mh-e form
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
296 (regexp-quote
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
297 mail-header-separator)) ;sendmail.el form
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
298 "\\|") ;or them together
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
299 "\\)$") ;end of line
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
300 nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
301 'move) ;search for and move
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
302 (buffer-substring (match-beginning 0) (match-end 0))))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
303
11422
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
304 ;; Serves as an interface to `mail',
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
305 ;; but when the user says "no" to discarding an unset message,
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
306 ;; it gives an error.
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
307 (defun reporter-mail (&rest args)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
308 (interactive "P")
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
309 (or (apply 'mail args)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
310 (error "Bug report aborted")))
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
311
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
312 ;;;###autoload
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (defun reporter-submit-bug-report
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (address pkgname varlist &optional pre-hooks post-hooks salutation)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
315 ;; Submit a bug report via mail.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
316
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
317 ;; ADDRESS is the email address for the package's maintainer. PKGNAME is
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
318 ;; the name of the mode (you must explicitly concat any version numbers).
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
319 ;; VARLIST is the list of variables to dump (see `reporter-dump-state'
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
320 ;; for details). Optional PRE-HOOKS and POST-HOOKS are passed to
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
321 ;; `reporter-dump-state'. Optional SALUTATION is inserted at the top of the
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
322 ;; mail buffer, and point is left after the salutation.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
324 ;; This function will prompt for a summary if
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
325 ;; reporter-prompt-for-summary-p is non-nil.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
327 ;; The mailer used is described in the variable `reporter-mailer'.
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
328 (let ((reporter-eval-buffer (current-buffer))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
329 final-resting-place
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
330 after-sep-pos
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
331 (reporter-status-message "Formatting bug report buffer...")
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
332 (reporter-status-count 0)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
333 (problem (and reporter-prompt-for-summary-p
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
334 (read-string "(Very) brief summary of problem: ")))
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
335 (mailbuf
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
336 (progn
11422
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
337 (call-interactively
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
338 (if (nlistp reporter-mailer)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
339 reporter-mailer
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
340 (let ((mlist reporter-mailer)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
341 (mailer nil))
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
342 (while mlist
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
343 (if (commandp (car mlist))
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
344 (setq mailer (car mlist)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
345 mlist nil)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
346 (setq mlist (cdr mlist))))
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
347 (if (not mailer)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
348 (error
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
349 "Variable `%s' does not contain a command for mailing"
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
350 "reporter-mailer"))
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
351 mailer)))
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
352 (current-buffer))))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 (require 'sendmail)
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
354 (pop-to-buffer reporter-eval-buffer)
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 (pop-to-buffer mailbuf)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 (goto-char (point-min))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 ;; different mailers use different separators, some may not even
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 ;; use m-h-s, but sendmail.el stuff must have m-h-s bound.
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
359 (let ((mail-header-separator (reporter-calculate-separator)))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 (mail-position-on-field "to")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (insert address)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
362 ;; insert problem summary if available
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
363 (if (and reporter-prompt-for-summary-p problem pkgname)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
364 (progn
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
365 (mail-position-on-field "subject")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
366 (insert pkgname "; " problem)))
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
367 ;; move point to the body of the message
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
368 (mail-text)
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 (forward-line 1)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
370 (setq after-sep-pos (point))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (and salutation (insert "\n" salutation "\n\n"))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
372 (unwind-protect
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
373 (progn
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
374 (setq final-resting-place (point-marker))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
375 (insert "\n\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
376 (reporter-dump-state pkgname varlist pre-hooks post-hooks)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
377 (goto-char final-resting-place))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
378 (set-marker final-resting-place nil)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
379
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
380 ;; save initial text and set up the `no-empty-submission' hook.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
381 ;; This only works for mailers that support mail-send-hook,
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
382 ;; e.g. sendmail.el
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
383 (if (fboundp 'add-hook)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
384 (progn
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
385 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
386 (goto-char (point-max))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
387 (skip-chars-backward " \t\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
388 (setq reporter-initial-text
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
389 (buffer-substring after-sep-pos (point))))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
390 (make-variable-buffer-local 'mail-send-hook)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
391 (add-hook 'mail-send-hook 'reporter-bug-hook)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
392
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
393 ;; minibuf message
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
394 ;; C-c C-c can't be generalized because they don't always run
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
395 ;; mail-send-and-exit. E.g. vm-mail-send-and-exit. I don't want
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
396 ;; to hard code these.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
397 (let* ((sendkey "C-c C-c")
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (killkey-whereis (where-is-internal 'kill-buffer nil t))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (killkey (if killkey-whereis
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (key-description killkey-whereis)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 "M-x kill-buffer")))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (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
403 sendkey killkey))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 ))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
406 (defun reporter-bug-hook ()
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
407 ;; prohibit sending mail if empty bug report
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
408 (let ((after-sep-pos
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
409 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
410 (beginning-of-buffer)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
411 (re-search-forward (reporter-calculate-separator) (point-max) 'move)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
412 (forward-line 1)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
413 (point))))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
414 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
415 (goto-char (point-max))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
416 (skip-chars-backward " \t\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
417 (if (and (= (- (point) after-sep-pos)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
418 (length reporter-initial-text))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
419 (string= (buffer-substring after-sep-pos (point))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
420 reporter-initial-text))
11212
db8f78f3f9a9 (reporter-submit-bug-report): Give up if mailer
Richard M. Stallman <rms@gnu.org>
parents: 10227
diff changeset
421 (error "Empty bug report cannot be sent"))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
422 )))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
423
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
424
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (provide 'reporter)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 ;;; reporter.el ends here