annotate lisp/utils/reporter.el @ 0:376386a54a3c r19-14

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