annotate lisp/mail/reporter.el @ 98701:5970e7c70c96

* vc-git.el (vc-git-show-log-entry): Include the revision in the search string.
author Dan Nicolaescu <dann@ics.uci.edu>
date Tue, 14 Oct 2008 07:05:07 +0000
parents ef65fa4dca3b
children a9dc0e7c3f2b
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
74509
f7702c5f335d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68648
diff changeset
3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003,
79712
de499b20517a Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
4 ;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14004
diff changeset
5
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
6 ;; Author: 1993-1998 Barry A. Warsaw
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
7 ;; Maintainer: FSF
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; Created: 19-Apr-1993
15590
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
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
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
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
16 ;; (at your option) any later version.
4855
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
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
26 ;;; Commentary:
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14004
diff changeset
27
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
28 ;; End User Interface
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
29 ;; ==================
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
30 ;; The variable `mail-user-agent' contains a symbol indicating which
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
31 ;; Emacs mail package end users would like to use to compose outgoing
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
32 ;; mail. See that variable for details (it is no longer defined in
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
33 ;; this file).
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
34
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
35 ;; Lisp Package Authors
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
36 ;; ====================
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
37 ;; reporter.el was written primarily for Emacs Lisp package authors so
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
38 ;; that their users can more easily report bugs. When invoked,
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
39 ;; `reporter-submit-bug-report' will set up an outgoing mail buffer
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
40 ;; with the appropriate bug report address, including a lisp
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
41 ;; expression the maintainer of the package can evaluate to completely
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
42 ;; reproduce the environment in which the bug was observed (e.g. by
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
43 ;; using `eval-last-sexp'). This package proved especially useful
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
44 ;; during my development of CC Mode, which is highly dependent on its
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
45 ;; configuration variables.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;;
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; Do a "C-h f reporter-submit-bug-report" for more information.
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; Here's an example usage:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;;
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
50 ;;(defconst mypkg-version "9.801")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
51 ;;(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
52 ;;(defun mypkg-submit-bug-report ()
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
53 ;; "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
54 ;; (interactive)
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
55 ;; (require 'reporter)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
56 ;; (reporter-submit-bug-report
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
57 ;; mypkg-maintainer-address
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
58 ;; (concat "mypkg.el " mypkg-version)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
59 ;; (list 'mypkg-variable-1
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
60 ;; 'mypkg-variable-2
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
61 ;; ;; ...
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
62 ;; 'mypkg-variable-last)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
63
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;;; Code:
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
66
15530
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
67 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
68 ;; Package author interface variables
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
69
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
70 (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
71 "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
72 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
73 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
74 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
75 string.
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
76
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
77 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
78 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
79 `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
80 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
81
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
82 (defvar reporter-dont-compact-list nil
14004
7709c74b3188 (reporter-dont-compact-list): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 11422
diff changeset
83 "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
84 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
85 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
86 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
87 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
88 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
89 sexp per line.
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
90
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
91 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
92 `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
93 bind it.")
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
95 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15530
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
96 ;; End of editable variables
77f3cbbd5d70 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15319
diff changeset
97
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
98
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
99 (defvar reporter-eval-buffer nil
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
100 "Buffer to retrieve variable's value from.
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
101 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
102 variables. Current buffer will always be the mail buffer being
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
103 composed.")
4855
e12addbc2c52 (reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents: 4839
diff changeset
104
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
105 (defvar reporter-initial-text nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
106 "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
107 (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
108
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
109
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
110
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
111 ;; 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
112 (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
113 (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
114
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
115 (defun reporter-update-status ()
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
116 "Periodically output a status message."
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
117 (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
118 (progn
87170
e50a2e215441 * erc-stamp.el (erc-echo-timestamp):
David Kastrup <dak@gnu.org>
parents: 86440
diff changeset
119 (message "%s" reporter-status-message)
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
120 (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
121 (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
122
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
124 ;; 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
125 (defun reporter-beautify-list (maxwidth compact-p)
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
126 "Pretty print a list."
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
127 (reporter-update-status)
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
128 (let ((move t)
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
129 linebreak indent-enclosing-p indent-p here)
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
130 (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
131 (progn
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
132 (down-list 1)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
133 (setq indent-enclosing-p t)
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
134 (while move
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
135 (setq here (point))
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
136 ;; The following line is how we break out of the while
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
137 ;; loop, in one of two ways. Either we've hit the end of
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
138 ;; the buffer, in which case scan-sexps returns nil, or
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
139 ;; we've crossed unbalanced parens and it will raise an
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
140 ;; error we're expecting to catch.
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
141 (setq move (scan-sexps (point) 1))
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
142 (goto-char move)
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
143 (if (<= maxwidth (current-column))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
144 (if linebreak
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
145 (progn
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
146 (goto-char linebreak)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
147 (newline-and-indent)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
148 (setq linebreak nil))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
149 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
150 (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
151 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
152 (forward-sexp 1)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
153 (if indent-p
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
154 (newline-and-indent))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
155 t)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
156 (if compact-p
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
157 (setq linebreak (point))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
158 (newline-and-indent))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
159 ))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
160 t)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
161 (error indent-enclosing-p))))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
162
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
163 (defun reporter-lisp-indent (indent-point state)
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
164 "A better lisp indentation style for bug reporting."
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
165 (save-excursion
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
166 (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
167 (current-column)))
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
168
86440
4aedd218aad1 * mail/mspools.el (rmail-get-new-mail):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85231
diff changeset
169 (declare-function mail-position-on-field "sendmail" (field &optional soft))
4aedd218aad1 * mail/mspools.el (rmail-get-new-mail):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85231
diff changeset
170 (declare-function mail-text "sendmail" ())
4aedd218aad1 * mail/mspools.el (rmail-get-new-mail):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85231
diff changeset
171
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
172 (defun reporter-dump-variable (varsym mailbuf)
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
173 "Pretty-print the value of the variable in symbol VARSYM.
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
174 MAILBUF 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
175 (reporter-update-status)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
176 (condition-case nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
177 (let ((val (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
178 (set-buffer reporter-eval-buffer)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
179 (symbol-value varsym)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
180 (sym (symbol-name varsym))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
181 (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
182 (maxwidth (1- (window-width)))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
183 (here (point)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
184 (insert " " sym " "
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
185 (cond
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
186 ((memq val '(t nil)) "")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
187 ((listp val) "'")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
188 ((symbolp val) "'")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
189 (t ""))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
190 (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
191 (lisp-indent-line)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
192 ;; 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
193 ;; enough to wrap
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
194 (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
195 (listp val)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
196 (<= maxwidth (current-column)))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
197 (save-excursion
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
198 (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
199 (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
200 (goto-char here)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
201 (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
202 (insert "\n"))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
203 (void-variable
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
204 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
205 (set-buffer mailbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
206 (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
207 (end-of-line)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
208 (insert (symbol-name varsym) " ")))
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
209 (error
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
210 (error ""))))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 (defun reporter-dump-state (pkgname varlist pre-hooks post-hooks)
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
213 "Dump the state of the mode specific variables.
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
214 PKGNAME contains the name of the mode as it will appear in the bug
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
215 report (you must explicitly concat any version numbers).
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
217 VARLIST is the list of variables to dump. Each element in
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
218 VARLIST can be a variable symbol, or a cons cell. If a symbol,
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
219 this will be passed to `reporter-dump-variable' for insertion
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
220 into the mail buffer. If a cons cell, the car must be a variable
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
221 symbol and the cdr must be a function which will be `funcall'd
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
222 with arguments the symbol and the mail buffer being composed. Use
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
223 this to write your own custom variable value printers for
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
224 specific variables.
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
225
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
226 Note that the global variable `reporter-eval-buffer' will be bound to
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
227 the buffer in which `reporter-submit-bug-report' was invoked. If you
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
228 want to print the value of a buffer local variable, you should wrap
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
229 the `eval' call in your custom printer inside a `set-buffer' (and
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
230 probably a `save-excursion'). `reporter-dump-variable' handles this
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
231 properly.
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
232
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
233 PRE-HOOKS is run after the Emacs version and PKGNAME are inserted, but
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
234 before the VARLIST is dumped. POST-HOOKS is run after the VARLIST is
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
235 dumped."
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 (let ((buffer (current-buffer)))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 (set-buffer buffer)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
238 (insert "Emacs : " (emacs-version) "\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
239 (and pkgname
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
240 (insert "Package: " pkgname "\n"))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 (run-hooks 'pre-hooks)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
242 (if (not varlist)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
243 nil
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
244 (insert "\ncurrent state:\n==============\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
245 ;; 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
246 ;; 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
247 (condition-case fault
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
248 (let ((mailbuf (current-buffer))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
249 (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
250 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
251 (set-buffer elbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
252 (emacs-lisp-mode)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
253 (erase-buffer)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
254 (insert "(setq\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
255 (lisp-indent-line)
85231
054956601c9e (reporter-dump-state): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
256 (mapc
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
257 (function
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
258 (lambda (varsym-or-cons-cell)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
259 (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
260 varsym-or-cons-cell))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
261 (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
262 'reporter-dump-variable)))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
263 (funcall printer varsym mailbuf)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
264 )))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
265 varlist)
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
266 (lisp-indent-line)
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
267 (insert ")\n"))
64806
74dda054615b (reporter-dump-state): Use insert-buffer-substring.
Richard M. Stallman <rms@gnu.org>
parents: 64754
diff changeset
268 (insert-buffer-substring elbuf))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
269 (error
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
270 (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
271 (format "%s" fault)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
272 "\n\nYou should still send this bug report."))))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (run-hooks 'post-hooks)
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 ))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
276
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
277 (defun reporter-compose-outgoing ()
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
278 "Compose the outgoing mail buffer.
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
279
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
280 Return the selected paradigm, with the current buffer tacked onto the
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
281 beginning of the list."
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
282 (let* ((agent mail-user-agent)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
283 (compose (get mail-user-agent 'composefunc)))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
284 ;; 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
285 ;; protocol, otherwise we must signal an error.
21312
b5b8f2545eae (reporter-bug-hook): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents: 21230
diff changeset
286 (if (not (and compose (functionp compose)))
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
287 (progn
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
288 (setq agent 'sendmail-user-agent
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
289 compose (get agent 'composefunc))
21312
b5b8f2545eae (reporter-bug-hook): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents: 21230
diff changeset
290 (if (not (and compose (functionp compose)))
15978
86922cff9d87 (reporter-compose-outgoing): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents: 15590
diff changeset
291 (error "Could not find a valid `mail-user-agent'")
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
292 (ding)
15978
86922cff9d87 (reporter-compose-outgoing): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents: 15590
diff changeset
293 (message "`%s' is an invalid `mail-user-agent'; using `sendmail-user-agent'"
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
294 mail-user-agent)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
295 )))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
296 (funcall compose)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
297 agent))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
298
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
299
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
300 ;;;###autoload
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (defun reporter-submit-bug-report
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (address pkgname varlist &optional pre-hooks post-hooks salutation)
26176
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
303 "Begin submitting a bug report via email.
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
304
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
305 ADDRESS is the email address for the package's maintainer. PKGNAME is
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
306 the name of the package (if you want to include version numbers,
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
307 you must put them into PKGNAME before calling this function).
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
308 Optional PRE-HOOKS and POST-HOOKS are passed to `reporter-dump-state'.
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
309 Optional SALUTATION is inserted at the top of the mail buffer,
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
310 and point is left after the salutation.
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
311
26176
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
312 VARLIST is the list of variables to dump (see `reporter-dump-state'
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
313 for details). The optional argument PRE-HOOKS and POST-HOOKS are
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
314 passed to `reporter-dump-state'. Optional argument SALUTATION is text
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
315 to be inserted at the top of the mail buffer; in that case, point is
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
316 left after that text.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317
26176
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
318 This function prompts for a summary if `reporter-prompt-for-summary-p'
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
319 is non-nil.
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320
26176
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
321 This function does not send a message; it uses the given information
41362
73c81f0d57f2 (reporter-submit-bug-report): Doc fixes.
Colin Walters <walters@gnu.org>
parents: 38416
diff changeset
322 to initialize a message, which the user can then edit and finally send
38416
ac6b0bba8fcc (reporter-submit-bug-report):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29246
diff changeset
323 \(or decline to send). The variable `mail-user-agent' controls which
26176
181fc14cf624 Doc-fix.
Gerd Moellmann <gerd@gnu.org>
parents: 21998
diff changeset
324 mail-sending package is used for editing and sending the message."
3903
a1a2b1ee2554 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 3589
diff changeset
325 (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
326 final-resting-place
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
327 after-sep-pos
10227
31d062ac1d2f (reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents: 8280
diff changeset
328 (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
329 (reporter-status-count 0)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
330 (problem (and reporter-prompt-for-summary-p
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
331 (read-string (if (stringp reporter-prompt-for-summary-p)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
332 reporter-prompt-for-summary-p
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
333 "(Very) brief summary of problem: "))))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
334 (agent (reporter-compose-outgoing))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
335 (mailbuf (current-buffer))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
336 hookvar)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
337 ;; do the work
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 (require 'sendmail)
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
339 ;; If mailbuf did not get made visible before, make it visible now.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
340 (let (same-window-buffer-names same-window-regexps)
15319
4dbee658e623 (reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 15309
diff changeset
341 (pop-to-buffer mailbuf)
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
342 ;; Just in case the original buffer is not visible now, bring it
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
343 ;; back somewhere
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
344 (and pop-up-windows (display-buffer reporter-eval-buffer)))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 (goto-char (point-min))
21865
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
346 (mail-position-on-field "to")
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
347 (insert address)
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
348 ;; insert problem summary if available
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
349 (if (and reporter-prompt-for-summary-p problem pkgname)
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
350 (progn
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
351 (mail-position-on-field "subject")
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
352 (insert pkgname "; " problem)))
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
353 ;; move point to the body of the message
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
354 (mail-text)
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
355 (forward-line 1)
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
356 (setq after-sep-pos (point))
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
357 (and salutation (insert "\n" salutation "\n\n"))
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
358 (unwind-protect
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
359 (progn
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
360 (setq final-resting-place (point-marker))
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
361 (insert "\n\n")
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
362 (reporter-dump-state pkgname varlist pre-hooks post-hooks)
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
363 (goto-char final-resting-place))
cedd1efb2892 (reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 21312
diff changeset
364 (set-marker final-resting-place nil))
8280
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 ;; save initial text and set up the `no-empty-submission' hook.
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
367 ;; This only works for mailers that support a pre-send hook, and
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
368 ;; for which the paradigm has a non-nil value for the `hookvar'
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
369 ;; key in its agent (i.e. sendmail.el's mail-send-hook).
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
370 (save-excursion
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
371 (goto-char (point-max))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
372 (skip-chars-backward " \t\n")
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
373 (setq reporter-initial-text (buffer-substring after-sep-pos (point))))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
374 (if (setq hookvar (get agent 'hookvar))
38416
ac6b0bba8fcc (reporter-submit-bug-report):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29246
diff changeset
375 (add-hook hookvar 'reporter-bug-hook nil t))
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
376
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
377 ;; compose the minibuf message and display this.
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
378 (let* ((sendkey-whereis (where-is-internal
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
379 (get agent 'sendfunc) nil t))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
380 (abortkey-whereis (where-is-internal
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
381 (get agent 'abortfunc) nil t))
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
382 (sendkey (if sendkey-whereis
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
383 (key-description sendkey-whereis)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
384 "C-c C-c")) ; TBD: BOGUS hardcode
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
385 (abortkey (if abortkey-whereis
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
386 (key-description abortkey-whereis)
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
387 "M-x kill-buffer")) ; TBD: BOGUS hardcode
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
388 )
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
389 (message "Please enter your report. Type %s to send, %s to abort."
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
390 sendkey abortkey))
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 ))
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
393 (defun reporter-bug-hook ()
29246
d6236052de66 Maintainer change. Doc fixes.
Dave Love <fx@gnu.org>
parents: 26176
diff changeset
394 "Prohibit sending mail if empty bug report."
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
395 (let ((after-sep-pos
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
396 (save-excursion
21998
ccda0e3ab1b6 (reporter-bug-hook): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents: 21865
diff changeset
397 (rfc822-goto-eoh)
8280
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
398 (forward-line 1)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
399 (point))))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
400 (save-excursion
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
401 (goto-char (point-max))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
402 (skip-chars-backward " \t\n")
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
403 (if (and (= (- (point) after-sep-pos)
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
404 (length reporter-initial-text))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
405 (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
406 reporter-initial-text))
21230
a553c7f85238 (reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents: 18628
diff changeset
407 (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
408 )))
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
409
2c26fd09c101 (reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
410
15590
296718a360cf Major rewrite.
Miles Bader <miles@gnu.org>
parents: 15530
diff changeset
411 (provide 'reporter)
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 41362
diff changeset
412
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
413 ;; arch-tag: 33612ff4-fbbc-4be2-b183-560ce9e0199b
3421
6cb1311434ba Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 ;;; reporter.el ends here