annotate lisp/mail/reporter.el @ 15863:f11b2bfc1275

new version from Torbj?Einarsson.
author Erik Naggum <erik@naggum.no>
date Wed, 14 Aug 1996 01:59:41 +0000
parents 296718a360cf
children 86922cff9d87
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
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
3 ;; Copyright (C) 1993 1994 1995 1996 Free Software Foundation, Inc.
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14004
diff changeset
4
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
5 ;; Author: 1993-1996 Barry A. Warsaw
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Created: 19-Apr-1993
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
7 ;; Version: 3.3
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
8 ;; Last Modified: 1996/07/02 00:39:09
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
9 ;; Keywords: maint mail tools
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
4839
4df93ff816c4 fix comment
David J. MacKenzie <djm@gnu.org>
parents: 3903
diff changeset
11 ;; 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
12
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
13 ;; 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
14 ;; 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
15 ;; 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
16 ;; any later version.
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
17
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
18 ;; 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
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; 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
22
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14004
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14004
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14004
diff changeset
26 ;; Boston, MA 02111-1307, USA.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
28 ;;; Commentary:
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14004
diff changeset
29
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
30 ;; End User Interface
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
31 ;; ==================
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
32 ;; The variable `mail-user-agent' contains a symbol indicating which
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
33 ;; Emacs mail package end users would like to use to compose outgoing
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
34 ;; mail. See that variable for details.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
35
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
36 ;; Mail Package Interface
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
37 ;; ======================
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
38 ;; Mail package authors can configure reporter to support their
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
39 ;; package by calling the function `define-mail-user-agent' See that
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
40 ;; function for details.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
41
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
42 ;; Lisp Package Authors
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
43 ;; ====================
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
44 ;; Reporter was written primarily for Emacs Lisp package authors so
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
45 ;; that their users can easily report bugs. When invoked,
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
46 ;; reporter-submit-bug-report will set up an outgoing mail buffer with
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
47 ;; the appropriate bug report address, including a lisp expression the
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
48 ;; maintainer of the package can eval to completely reproduce the
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
49 ;; environment in which the bug was observed (e.g. by using
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
50 ;; eval-last-sexp). This package proved especially useful during my
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
51 ;; development of cc-mode, which is highly dependent on its
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
52 ;; configuration variables.
3421
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 ;; Do a "C-h f reporter-submit-bug-report" for more information.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; Here's an example usage:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;;
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
57 ;;(defconst mypkg-version "9.801")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
58 ;;(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
59 ;;(defun mypkg-submit-bug-report ()
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
60 ;; "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
61 ;; (interactive)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
62 ;; (reporter-submit-bug-report
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
63 ;; mypkg-maintainer-address
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
64 ;; (concat "mypkg.el " mypkg-version)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
65 ;; (list 'mypkg-variable-1
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
66 ;; 'mypkg-variable-2
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
67 ;; ;; ...
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
68 ;; 'mypkg-variable-last)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
69
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;; Mailing List
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;; ============
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
72 ;; I've set up a Majordomo mailing list to report bugs or suggest
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
73 ;; enhancements, etc. This list's intended audience is elisp package
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
74 ;; authors who are using reporter and want to stay current with
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
75 ;; releases. Here are the relevant addresses:
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;;
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
77 ;; Administrivia: reporter-request@python.org
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
78 ;; Submissions: reporter@python.org
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
80 ;; Packages that currently use reporter are: cc-mode, supercite, elp,
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
81 ;; tcl, ediff, crypt++ (crypt), dired-x, rmailgen, mode-line, vm,
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
82 ;; mh-e, edebug, archie, viper, w3-mode, framepop, hl319, hilit19,
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
83 ;; pgp, eos, hm--html, efs.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
84 ;;
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
85 ;; If you know of others, please email me!
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 ;;; Code:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
90 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
91 ;; End user interface
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
93 ;;;###autoload
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
94 (defvar mail-user-agent 'sendmail-user-agent
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
95 "*Your preference for a mail composition package.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
96 Various Emacs Lisp packages (e.g. reporter) require you to compose an
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
97 outgoing email message. As there are several such packages available
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
98 for Emacs, you can indicate your preference by setting this variable.
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
99
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
100 Valid values currently are:
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
101
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
102 'sendmail-user-agent -- use Emacs built-in Mail package
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
103 'vm-user-agent -- use Kyle Jones' VM package
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
104 'mh-e-user-agent -- use the Emacs interface to the MH mail system
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
105
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
106 Additional valid symbols may be available; check with the author of
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
107 your package for details.")
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
108
15530
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
109
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
110
15530
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
111 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
112 ;; Package author interface variables
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
113
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
114 (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
115 "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
116 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
117 brief summary of the problem, and puts this summary on the Subject:
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
118 line. If this variable is a string, that string is used as the prompt
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
119 string.
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
120
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
121 Default behavior is to not prompt (i.e. nil). If you want reporter to
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
122 prompt, you should `let' bind this variable before calling
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
123 `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
124 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
125
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
126 (defvar reporter-dont-compact-list nil
14004
7709c74b3188 (reporter-dont-compact-list): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 11422
diff changeset
127 "Interface variable controlling compacting of list values.
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
128 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
129 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
130 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
131 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
132 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
133 sexp per line.
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
134
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
135 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
136 `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
137 bind it.")
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
139 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15530
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
140 ;; End of editable variables
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
141
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
142
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
143 (defvar reporter-eval-buffer nil
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
144 "Buffer to retrieve variable's value from.
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
145 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
146 variables. Current buffer will always be the mail buffer being
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
147 composed.")
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
148
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
149 (defconst reporter-version "3.2"
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
150 "Reporter version number.")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
151
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
152 (defvar reporter-initial-text nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
153 "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
154 (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
155
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
156
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
157
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
158 ;; status feedback to the user
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
159 (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
160 (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
161
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
162 (defun reporter-update-status ()
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
163 ;; 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
164 (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
165 (progn
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
166 (message reporter-status-message)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
167 (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
168 (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
169
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
171 ;; dumping/pretty printing of values
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
172 (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
173 ;; pretty print a list
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
174 (reporter-update-status)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
175 (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
176 (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
177 (progn
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
178 (down-list 1)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
179 (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
180 (while t
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
181 (setq here (point))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
182 (forward-sexp 1)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
183 (if (<= maxwidth (current-column))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
184 (if linebreak
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
185 (progn
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
186 (goto-char linebreak)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
187 (newline-and-indent)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
188 (setq linebreak nil))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
189 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
190 (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
191 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
192 (forward-sexp 1)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
193 (if indent-p
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
194 (newline-and-indent))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
195 t)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
196 (if compact-p
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
197 (setq linebreak (point))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
198 (newline-and-indent))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
199 ))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
200 t)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
201 (error indent-enclosing-p))))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
202
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
203 (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
204 ;; 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
205 (save-excursion
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
206 (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
207 (current-column)))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
208
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
209 (defun reporter-dump-variable (varsym mailbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
210 ;; 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
211 ;; 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
212 (reporter-update-status)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
213 (condition-case nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
214 (let ((val (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
215 (set-buffer reporter-eval-buffer)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
216 (symbol-value varsym)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
217 (sym (symbol-name varsym))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
218 (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
219 (maxwidth (1- (window-width)))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
220 (here (point)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
221 (insert " " sym " "
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
222 (cond
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
223 ((memq val '(t nil)) "")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
224 ((listp val) "'")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
225 ((symbolp val) "'")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
226 (t ""))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
227 (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
228 (lisp-indent-line)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
229 ;; 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
230 ;; enough to wrap
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
231 (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
232 (listp val)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
233 (<= maxwidth (current-column)))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
234 (save-excursion
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
235 (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
236 (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
237 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
238 (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
239 (insert "\n"))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
240 (void-variable
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
241 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
242 (set-buffer mailbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
243 (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
244 (end-of-line)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
245 (insert (symbol-name varsym) " ")))
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
246 (error
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
247 (error ""))))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 (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
250 ;; 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
251 ;; 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
252 ;; report (you must explicitly concat any version numbers).
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
254 ;; 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
255 ;; 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
256 ;; 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
257 ;; 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
258 ;; 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
259 ;; 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
260 ;; 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
261 ;; specific variables.
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
262
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
263 ;; 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
264 ;; 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
265 ;; 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
266 ;; 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
267 ;; 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
268 ;; properly.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
269
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
270 ;; 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
271 ;; 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
272 ;; dumped.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (let ((buffer (current-buffer)))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 (set-buffer buffer)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
275 (insert "Emacs : " (emacs-version) "\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
276 (and pkgname
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
277 (insert "Package: " pkgname "\n"))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (run-hooks 'pre-hooks)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
279 (if (not varlist)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
280 nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
281 (insert "\ncurrent state:\n==============\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
282 ;; 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
283 ;; 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
284 (condition-case fault
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
285 (let ((mailbuf (current-buffer))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
286 (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
287 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
288 (set-buffer elbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
289 (emacs-lisp-mode)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
290 (erase-buffer)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
291 (insert "(setq\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
292 (lisp-indent-line)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
293 (mapcar
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
294 (function
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
295 (lambda (varsym-or-cons-cell)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
296 (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
297 varsym-or-cons-cell))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
298 (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
299 'reporter-dump-variable)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
300 (funcall printer varsym mailbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
301 )))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
302 varlist)
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
303 (lisp-indent-line)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
304 (insert ")\n"))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
305 (insert-buffer elbuf))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
306 (error
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
307 (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
308 (format "%s" fault)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
309 "\n\nYou should still send this bug report."))))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (run-hooks 'post-hooks)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 ))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
313
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
314 (defun reporter-calculate-separator ()
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
315 ;; 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
316 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
317 (re-search-forward
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
318 (concat
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
319 "^\\(" ;beginning of line
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
320 (mapconcat
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
321 'identity
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
322 (list "[\t ]*" ;simple SMTP form
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
323 "-+" ;mh-e form
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
324 (regexp-quote
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
325 mail-header-separator)) ;sendmail.el form
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
326 "\\|") ;or them together
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
327 "\\)$") ;end of line
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
328 nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
329 'move) ;search for and move
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
330 (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
331
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
332
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
333 ;; Serves as an interface to `mail' (sendmail.el), but when the user
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
334 ;; answers "no" to discarding an unsent message, it gives an error.
11422
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
335 (defun reporter-mail (&rest args)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
336 (or (apply 'mail args)
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
337 (error "Bug report aborted")))
fd0a461e9c72 (reporter-mailer): Replace mail with reporter-mail.
Richard M. Stallman <rms@gnu.org>
parents: 11212
diff changeset
338
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
339 (defun reporter-compose-outgoing ()
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
340 ;; compose the outgoing mail buffer, and return the selected
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
341 ;; paradigm, with the current-buffer tacked onto the beginning of
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
342 ;; the list.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
343 (let* ((agent mail-user-agent)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
344 (compose (get mail-user-agent 'composefunc)))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
345 ;; Sanity check. If this fails then we'll try to use the SENDMAIL
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
346 ;; protocol, otherwise we must signal an error.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
347 (if (not (and compose (fboundp compose)))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
348 (progn
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
349 (setq agent 'sendmail-user-agent
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
350 compose (get agent 'composefunc))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
351 (if (not (and compose (fboundp compose)))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
352 (error "Could not find a valid `mail-user-agent'.")
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
353 (ding)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
354 (message "`%s' is an invalid `mail-user-agent'; using `sendmail-user-agent'."
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
355 mail-user-agent)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
356 )))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
357 (funcall compose)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
358 agent))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
359
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
360
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
361 ;;;###autoload
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 (defun reporter-submit-bug-report
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 (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
364 ;; Submit a bug report via mail.
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
365
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
366 ;; 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
367 ;; 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
368 ;; 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
369 ;; 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
370 ;; `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
371 ;; mail buffer, and point is left after the salutation.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
373 ;; 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
374 ;; reporter-prompt-for-summary-p is non-nil.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
376 ;; The mailer used is described in by the variable `mail-user-agent'.
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
377 (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
378 final-resting-place
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
379 after-sep-pos
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
380 (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
381 (reporter-status-count 0)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
382 (problem (and reporter-prompt-for-summary-p
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
383 (read-string (if (stringp reporter-prompt-for-summary-p)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
384 reporter-prompt-for-summary-p
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
385 "(Very) brief summary of problem: "))))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
386 (agent (reporter-compose-outgoing))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
387 (mailbuf (current-buffer))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
388 hookvar)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
389 ;; do the work
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (require 'sendmail)
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
391 ;; If mailbuf did not get made visible before, make it visible now.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
392 (let (same-window-buffer-names same-window-regexps)
15319
4dbee658e623 (reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 15309
diff changeset
393 (pop-to-buffer mailbuf)
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
394 ;; Just in case the original buffer is not visible now, bring it
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
395 ;; back somewhere
15319
4dbee658e623 (reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 15309
diff changeset
396 (display-buffer reporter-eval-buffer))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (goto-char (point-min))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 ;; different mailers use different separators, some may not even
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
399 ;; use mail-header-separator, but sendmail.el stuff must have this
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
400 ;; variable bound.
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
401 (let ((mail-header-separator (reporter-calculate-separator)))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (mail-position-on-field "to")
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (insert address)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
404 ;; insert problem summary if available
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
405 (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
406 (progn
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
407 (mail-position-on-field "subject")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
408 (insert pkgname "; " problem)))
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
409 ;; 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
410 (mail-text)
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (forward-line 1)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
412 (setq after-sep-pos (point))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 (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
414 (unwind-protect
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
415 (progn
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
416 (setq final-resting-place (point-marker))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
417 (insert "\n\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
418 (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
419 (goto-char final-resting-place))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
420 (set-marker final-resting-place nil)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
421
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
422 ;; save initial text and set up the `no-empty-submission' hook.
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
423 ;; This only works for mailers that support a pre-send hook, and
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
424 ;; for which the paradigm has a non-nil value for the `hookvar'
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
425 ;; key in its agent (i.e. sendmail.el's mail-send-hook).
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
426 (save-excursion
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
427 (goto-char (point-max))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
428 (skip-chars-backward " \t\n")
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
429 (setq reporter-initial-text (buffer-substring after-sep-pos (point))))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
430 (if (setq hookvar (get agent 'hookvar))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
431 (progn
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
432 (make-variable-buffer-local hookvar)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
433 (add-hook hookvar 'reporter-bug-hook)))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
434
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
435 ;; compose the minibuf message and display this.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
436 (let* ((sendkey-whereis (where-is-internal
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
437 (get agent 'sendfunc) nil t))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
438 (abortkey-whereis (where-is-internal
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
439 (get agent 'abortfunc) nil t))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
440 (sendkey (if sendkey-whereis
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
441 (key-description sendkey-whereis)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
442 "C-c C-c")) ; TBD: BOGUS hardcode
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
443 (abortkey (if abortkey-whereis
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
444 (key-description abortkey-whereis)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
445 "M-x kill-buffer")) ; TBD: BOGUS hardcode
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
446 )
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
447 (message "Please enter your report. Type %s to send, %s to abort."
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
448 sendkey abortkey))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 ))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
451 (defun reporter-bug-hook ()
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
452 ;; 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
453 (let ((after-sep-pos
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
454 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
455 (beginning-of-buffer)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
456 (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
457 (forward-line 1)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
458 (point))))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
459 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
460 (goto-char (point-max))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
461 (skip-chars-backward " \t\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
462 (if (and (= (- (point) after-sep-pos)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
463 (length reporter-initial-text))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
464 (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
465 reporter-initial-text))
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
466 (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
467 )))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
468
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
469
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
470 ;; paradigm definitions
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
471 (defun define-mail-user-agent (symbol composefunc sendfunc
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
472 &optional abortfunc hookvar)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
473 "Define a symbol appropriate for `mail-user-agent'.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
474
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
475 SYMBOL can be any meaningful lisp symbol. It need not have a function
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
476 or variable definition, as it is only used for its property list.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
477 The property names are equivalent to the formal argument described
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
478 below (but in lower case). Additional properties can be placed on the
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
479 symbol.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
480
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
481 COMPOSEFUNC is program callable function that composes an outgoing
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
482 mail message buffer. This function should set up the basics of the
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
483 buffer without requiring user interaction. It should populate the
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
484 standard mail headers, leaving the `to:' and `subject:' headers blank.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
485
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
486 SENDFUNC is the command a user would type to send the message.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
487
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
488 Optional ABORTFUNC is the command a user would type to abort the
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
489 message. For mail packages that don't have a separate abort function,
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
490 this can be `kill-buffer' (the equivalent of omitting this argument).
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
492 Optional HOOKVAR is a hook variable that gets run before the message
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
493 is actually sent. Reporter will install `reporter-bug-hook' onto this
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
494 hook so that empty bug reports can be suppressed by raising an error.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
495 If not supplied, `mail-send-hook' will be used."
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
496 (put symbol 'composefunc composefunc)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
497 (put symbol 'sendfunc sendfunc)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
498 (put symbol 'abortfunc (or abortfunc 'kill-buffer))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
499 (put symbol 'hookvar (or hookvar 'mail-send-hook)))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
500
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
501 (define-mail-user-agent 'sendmail-user-agent
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
502 'reporter-mail 'mail-send-and-exit)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
503
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
504 (define-mail-user-agent 'vm-user-agent
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
505 'vm-mail 'vm-mail-send-and-exit)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
506
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
507 (define-mail-user-agent 'mh-e-user-agent
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
508 'mh-smail-batch 'mh-send-letter 'mh-fully-kill-draft
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
509 'mh-before-send-letter-hook)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
510
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
511
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
512 (provide 'reporter)
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 ;;; reporter.el ends here