Mercurial > emacs
annotate lisp/mail/reporter.el @ 29077:07f205e3af83
Add debug-ignored-errors.
(dabbrev-completion): Use mapc.
author | Dave Love <fx@gnu.org> |
---|---|
date | Mon, 22 May 2000 17:30:42 +0000 |
parents | 181fc14cf624 |
children | d6236052de66 |
rev | line source |
---|---|
3421 | 1 ;;; reporter.el --- customizable bug reporting of lisp programs |
2 | |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
3 ;; Copyright (C) 1993,1994,1995,1996,1997,1998 Free Software Foundation, Inc. |
14169 | 4 |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
5 ;; Author: 1993-1998 Barry A. Warsaw |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
6 ;; Maintainer: tools-help@python.org |
3421 | 7 ;; Created: 19-Apr-1993 |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
8 ;; Version: 3.34 |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
9 ;; Last Modified: 1998/03/19 17:21:16 |
15590 | 10 ;; Keywords: maint mail tools |
3421 | 11 |
4839 | 12 ;; 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
|
13 |
e12addbc2c52
(reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents:
4839
diff
changeset
|
14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
3421 | 15 ;; 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
|
16 ;; 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
|
17 ;; any later version. |
e12addbc2c52
(reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents:
4839
diff
changeset
|
18 |
e12addbc2c52
(reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents:
4839
diff
changeset
|
19 ;; GNU Emacs is distributed in the hope that it will be useful, |
3421 | 20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; 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
|
23 |
3421 | 24 ;; You should have received a copy of the GNU General Public License |
14169 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
27 ;; Boston, MA 02111-1307, USA. | |
3421 | 28 |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
29 ;;; Commentary: |
14169 | 30 |
15590 | 31 ;; End User Interface |
32 ;; ================== | |
33 ;; The variable `mail-user-agent' contains a symbol indicating which | |
34 ;; 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
|
35 ;; 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
|
36 ;; this file). |
15590 | 37 |
38 ;; Lisp Package Authors | |
39 ;; ==================== | |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
40 ;; 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
|
41 ;; 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
|
42 ;; `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
|
43 ;; with the appropriate bug report address, including a lisp |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
44 ;; 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
|
45 ;; 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
|
46 ;; using `eval-last-sexp'). This package proved especially useful |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
47 ;; during my development of CC Mode, which is highly dependent on its |
15590 | 48 ;; configuration variables. |
3421 | 49 ;; |
50 ;; Do a "C-h f reporter-submit-bug-report" for more information. | |
51 ;; Here's an example usage: | |
52 ;; | |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
53 ;;(defconst mypkg-version "9.801") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
54 ;;(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
|
55 ;;(defun mypkg-submit-bug-report () |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
56 ;; "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
|
57 ;; (interactive) |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
58 ;; (require 'reporter) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
59 ;; (reporter-submit-bug-report |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
60 ;; mypkg-maintainer-address |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
61 ;; (concat "mypkg.el " mypkg-version) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
62 ;; (list 'mypkg-variable-1 |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
63 ;; 'mypkg-variable-2 |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
64 ;; ;; ... |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
65 ;; 'mypkg-variable-last))) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
66 |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
67 ;; Reporter Users |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
68 ;; ============== |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
69 ;; Packages that currently use reporter are: CC Mode, supercite, elp, |
15590 | 70 ;; tcl, ediff, crypt++ (crypt), dired-x, rmailgen, mode-line, vm, |
71 ;; mh-e, edebug, archie, viper, w3-mode, framepop, hl319, hilit19, | |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
72 ;; pgp, eos, hm--html, efs, webster19. |
15590 | 73 ;; |
74 ;; If you know of others, please email me! | |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
75 |
3421 | 76 ;;; Code: |
77 | |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
78 |
15530 | 79 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
80 ;; Package author interface variables | |
81 | |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
82 (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
|
83 "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
|
84 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
|
85 brief summary of the problem, and puts this summary on the Subject: |
15590 | 86 line. If this variable is a string, that string is used as the prompt |
87 string. | |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
88 |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
89 Default behavior is to not prompt (i.e. nil). If you want reporter to |
15590 | 90 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
|
91 `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
|
92 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
|
93 |
10227
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
94 (defvar reporter-dont-compact-list nil |
14004
7709c74b3188
(reporter-dont-compact-list): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
11422
diff
changeset
|
95 "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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 sexp per line. |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
102 |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
103 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
|
104 `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
|
105 bind it.") |
3421 | 106 |
15590 | 107 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
15530 | 108 ;; End of editable variables |
109 | |
15590 | 110 |
3903 | 111 (defvar reporter-eval-buffer nil |
112 "Buffer to retrieve variable's value from. | |
113 This is necessary to properly support the printing of buffer-local | |
114 variables. Current buffer will always be the mail buffer being | |
115 composed.") | |
4855
e12addbc2c52
(reporter-submit-bug-report, reporter-mailer): reporter-mailer
Richard M. Stallman <rms@gnu.org>
parents:
4839
diff
changeset
|
116 |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
117 (defconst reporter-version "3.34" |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
118 "Reporter version number.") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
119 |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
120 (defvar reporter-initial-text nil |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
121 "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
|
122 (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
|
123 |
15590 | 124 |
10227
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
125 |
15590 | 126 ;; 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
|
127 (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
|
128 (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
|
129 |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
130 (defun reporter-update-status () |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
131 ;; 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
|
132 (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
|
133 (progn |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
134 (message reporter-status-message) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
135 (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
|
136 (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
|
137 |
3421 | 138 |
15590 | 139 ;; 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
|
140 (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
|
141 ;; pretty print a list |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
142 (reporter-update-status) |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
143 (let ((move t) |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
144 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
|
145 (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
|
146 (progn |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
147 (down-list 1) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
148 (setq indent-enclosing-p t) |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
149 (while move |
10227
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
150 (setq here (point)) |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
151 ;; 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
|
152 ;; 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
|
153 ;; 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
|
154 ;; 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
|
155 ;; error we're expecting to catch. |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
156 (setq move (scan-sexps (point) 1)) |
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
157 (goto-char move) |
10227
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
158 (if (<= maxwidth (current-column)) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
159 (if linebreak |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
160 (progn |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
161 (goto-char linebreak) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
162 (newline-and-indent) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
163 (setq linebreak nil)) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
164 (goto-char here) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
165 (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
|
166 (goto-char here) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
167 (forward-sexp 1) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
168 (if indent-p |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
169 (newline-and-indent)) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
170 t) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
171 (if compact-p |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
172 (setq linebreak (point)) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
173 (newline-and-indent)) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
174 )) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
175 t) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
176 (error indent-enclosing-p)))) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
177 |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
178 (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
|
179 ;; 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
|
180 (save-excursion |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
181 (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
|
182 (current-column))) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
183 |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
184 (defun reporter-dump-variable (varsym mailbuf) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
185 ;; 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
|
186 ;; 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
|
187 (reporter-update-status) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
188 (condition-case nil |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
189 (let ((val (save-excursion |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
190 (set-buffer reporter-eval-buffer) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
191 (symbol-value varsym))) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
192 (sym (symbol-name varsym)) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
193 (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
|
194 (maxwidth (1- (window-width))) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
195 (here (point))) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
196 (insert " " sym " " |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
197 (cond |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
198 ((memq val '(t nil)) "") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
199 ((listp val) "'") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
200 ((symbolp val) "'") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
201 (t "")) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
202 (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
|
203 (lisp-indent-line) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
204 ;; 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
|
205 ;; enough to wrap |
10227
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
206 (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
|
207 (listp val) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
208 (<= maxwidth (current-column))) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
209 (save-excursion |
10227
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
210 (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
|
211 (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
|
212 (goto-char here) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
213 (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
|
214 (insert "\n")) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
215 (void-variable |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
216 (save-excursion |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
217 (set-buffer mailbuf) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
218 (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
|
219 (end-of-line) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
220 (insert (symbol-name varsym) " "))) |
15590 | 221 (error |
222 (error "")))) | |
3421 | 223 |
224 (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
|
225 ;; 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
|
226 ;; 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
|
227 ;; report (you must explicitly concat any version numbers). |
3421 | 228 |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
229 ;; 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
|
230 ;; 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
|
231 ;; 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
|
232 ;; 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
|
233 ;; 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
|
234 ;; 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
|
235 ;; 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
|
236 ;; specific variables. |
3903 | 237 |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
238 ;; 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
|
239 ;; 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
|
240 ;; 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
|
241 ;; 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
|
242 ;; 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
|
243 ;; properly. |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
244 |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
245 ;; 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
|
246 ;; 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
|
247 ;; dumped. |
3421 | 248 (let ((buffer (current-buffer))) |
249 (set-buffer buffer) | |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
250 (insert "Emacs : " (emacs-version) "\n") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
251 (and pkgname |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
252 (insert "Package: " pkgname "\n")) |
3421 | 253 (run-hooks 'pre-hooks) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
254 (if (not varlist) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
255 nil |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
256 (insert "\ncurrent state:\n==============\n") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
257 ;; 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
|
258 ;; 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
|
259 (condition-case fault |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
260 (let ((mailbuf (current-buffer)) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
261 (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
|
262 (save-excursion |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
263 (set-buffer elbuf) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
264 (emacs-lisp-mode) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
265 (erase-buffer) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
266 (insert "(setq\n") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
267 (lisp-indent-line) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
268 (mapcar |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
269 (function |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
270 (lambda (varsym-or-cons-cell) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
271 (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
|
272 varsym-or-cons-cell)) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
273 (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
|
274 'reporter-dump-variable))) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
275 (funcall printer varsym mailbuf) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
276 ))) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
277 varlist) |
10227
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
278 (lisp-indent-line) |
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
279 (insert ")\n")) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
280 (insert-buffer elbuf)) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
281 (error |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
282 (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
|
283 (format "%s" fault) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
284 "\n\nYou should still send this bug report.")))) |
3421 | 285 (run-hooks 'post-hooks) |
286 )) | |
287 | |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
288 |
15590 | 289 (defun reporter-compose-outgoing () |
290 ;; compose the outgoing mail buffer, and return the selected | |
291 ;; paradigm, with the current-buffer tacked onto the beginning of | |
292 ;; the list. | |
293 (let* ((agent mail-user-agent) | |
294 (compose (get mail-user-agent 'composefunc))) | |
295 ;; Sanity check. If this fails then we'll try to use the SENDMAIL | |
296 ;; 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
|
297 (if (not (and compose (functionp compose))) |
15590 | 298 (progn |
299 (setq agent 'sendmail-user-agent | |
300 compose (get agent 'composefunc)) | |
21312
b5b8f2545eae
(reporter-bug-hook): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
21230
diff
changeset
|
301 (if (not (and compose (functionp compose))) |
15978
86922cff9d87
(reporter-compose-outgoing): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
15590
diff
changeset
|
302 (error "Could not find a valid `mail-user-agent'") |
15590 | 303 (ding) |
15978
86922cff9d87
(reporter-compose-outgoing): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
15590
diff
changeset
|
304 (message "`%s' is an invalid `mail-user-agent'; using `sendmail-user-agent'" |
15590 | 305 mail-user-agent) |
306 ))) | |
307 (funcall compose) | |
308 agent)) | |
309 | |
310 | |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
311 ;;;###autoload |
3421 | 312 (defun reporter-submit-bug-report |
313 (address pkgname varlist &optional pre-hooks post-hooks salutation) | |
26176 | 314 "Begin submitting a bug report via email. |
315 | |
316 ADDRESS is the email address for the package's maintainer. PKGNAME is | |
317 the name of the package (if you want to include version numbers, | |
318 you must put them into PKGNAME before calling this function). | |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
319 |
26176 | 320 VARLIST is the list of variables to dump (see `reporter-dump-state' |
321 for details). The optional argument PRE-HOOKS and POST-HOOKS are | |
322 passed to `reporter-dump-state'. Optional argument SALUTATION is text | |
323 to be inserted at the top of the mail buffer; in that case, point is | |
324 left after that text. | |
3421 | 325 |
26176 | 326 This function prompts for a summary if `reporter-prompt-for-summary-p' |
327 is non-nil. | |
3421 | 328 |
26176 | 329 This function does not send a message; it uses the given information |
330 to initialize a a messagem, which the user can then edit and finally send | |
331 (or decline to send). The variable `mail-user-agent' controls which | |
332 mail-sending package is used for editing and sending the message." | |
3903 | 333 (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
|
334 final-resting-place |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
335 after-sep-pos |
10227
31d062ac1d2f
(reporter-submit-bug-report): Set up for status messages.
Richard M. Stallman <rms@gnu.org>
parents:
8280
diff
changeset
|
336 (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
|
337 (reporter-status-count 0) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
338 (problem (and reporter-prompt-for-summary-p |
15590 | 339 (read-string (if (stringp reporter-prompt-for-summary-p) |
340 reporter-prompt-for-summary-p | |
341 "(Very) brief summary of problem: ")))) | |
342 (agent (reporter-compose-outgoing)) | |
343 (mailbuf (current-buffer)) | |
344 hookvar) | |
345 ;; do the work | |
3421 | 346 (require 'sendmail) |
15590 | 347 ;; If mailbuf did not get made visible before, make it visible now. |
348 (let (same-window-buffer-names same-window-regexps) | |
15319
4dbee658e623
(reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
15309
diff
changeset
|
349 (pop-to-buffer mailbuf) |
15590 | 350 ;; Just in case the original buffer is not visible now, bring it |
351 ;; back somewhere | |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
352 (and pop-up-windows (display-buffer reporter-eval-buffer))) |
3421 | 353 (goto-char (point-min)) |
21865
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
354 (mail-position-on-field "to") |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
355 (insert address) |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
356 ;; insert problem summary if available |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
357 (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
|
358 (progn |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
359 (mail-position-on-field "subject") |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
360 (insert pkgname "; " problem))) |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
361 ;; move point to the body of the message |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
362 (mail-text) |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
363 (forward-line 1) |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
364 (setq after-sep-pos (point)) |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
365 (and salutation (insert "\n" salutation "\n\n")) |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
366 (unwind-protect |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
367 (progn |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
368 (setq final-resting-place (point-marker)) |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
369 (insert "\n\n") |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
370 (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
|
371 (goto-char final-resting-place)) |
cedd1efb2892
(reporter-calculate-separator): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
21312
diff
changeset
|
372 (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
|
373 |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
374 ;; save initial text and set up the `no-empty-submission' hook. |
15590 | 375 ;; This only works for mailers that support a pre-send hook, and |
376 ;; for which the paradigm has a non-nil value for the `hookvar' | |
377 ;; key in its agent (i.e. sendmail.el's mail-send-hook). | |
378 (save-excursion | |
379 (goto-char (point-max)) | |
380 (skip-chars-backward " \t\n") | |
381 (setq reporter-initial-text (buffer-substring after-sep-pos (point)))) | |
382 (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
|
383 (progn |
15590 | 384 (make-variable-buffer-local hookvar) |
385 (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
|
386 |
15590 | 387 ;; compose the minibuf message and display this. |
388 (let* ((sendkey-whereis (where-is-internal | |
389 (get agent 'sendfunc) nil t)) | |
390 (abortkey-whereis (where-is-internal | |
391 (get agent 'abortfunc) nil t)) | |
392 (sendkey (if sendkey-whereis | |
393 (key-description sendkey-whereis) | |
394 "C-c C-c")) ; TBD: BOGUS hardcode | |
395 (abortkey (if abortkey-whereis | |
396 (key-description abortkey-whereis) | |
397 "M-x kill-buffer")) ; TBD: BOGUS hardcode | |
398 ) | |
399 (message "Please enter your report. Type %s to send, %s to abort." | |
400 sendkey abortkey)) | |
3421 | 401 )) |
402 | |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
403 (defun reporter-bug-hook () |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
404 ;; 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
|
405 (let ((after-sep-pos |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
406 (save-excursion |
21998
ccda0e3ab1b6
(reporter-bug-hook): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
21865
diff
changeset
|
407 (rfc822-goto-eoh) |
8280
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
408 (forward-line 1) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
409 (point)))) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
410 (save-excursion |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
411 (goto-char (point-max)) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
412 (skip-chars-backward " \t\n") |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
413 (if (and (= (- (point) after-sep-pos) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
414 (length reporter-initial-text)) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
415 (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
|
416 reporter-initial-text)) |
21230
a553c7f85238
(reporter-mail): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18628
diff
changeset
|
417 (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
|
418 ))) |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
419 |
2c26fd09c101
(reporter-dump-state, reporter-submit-bug-report):
Richard M. Stallman <rms@gnu.org>
parents:
5140
diff
changeset
|
420 |
15590 | 421 (provide 'reporter) |
3421 | 422 ;;; reporter.el ends here |