aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-12-23 17:33:21 +0000
committerRichard M. Stallman1994-12-23 17:33:21 +0000
commit313f3cb427b60b87f0e6249a33c6db6156d34662 (patch)
tree40e6f1b77a7777cfaf9d926e8fa9873b1ed1f0f2
parent1a2c394158483e6df568e20c83f4cf6223035542 (diff)
downloademacs-313f3cb427b60b87f0e6249a33c6db6156d34662.tar.gz
emacs-313f3cb427b60b87f0e6249a33c6db6156d34662.zip
(reporter-submit-bug-report): Set up for status messages.
Use mail-text to position point to the body of the message. (reporter-beautify-list): Complete rewrite. Optional nocompact-p argument. (reporter-dump-variable): Invert the test and passing of compact-p argument to reporter-beautify-list. List values are not printed as defuns or function calls. Updated package list. (reporter-lisp-indent): New defun. (reporter-dont-compact-list) (reporter-status-message, reporter-status-count): New variables. (reporter-update-status, reporter-beautify-list) reporter-dump-variable): Now smarter about formating variables with list values. Checks the value of reporter-dont-compact-list.
-rw-r--r--lisp/mail/reporter.el142
1 files changed, 93 insertions, 49 deletions
diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el
index bc321bb69ad..9e1481a571b 100644
--- a/lisp/mail/reporter.el
+++ b/lisp/mail/reporter.el
@@ -1,10 +1,10 @@
1;;; reporter.el --- customizable bug reporting of lisp programs 1;;; reporter.el --- customizable bug reporting of lisp programs
2 2
3;; Author: 1993 Barry A. Warsaw, Century Computing Inc. <bwarsaw@cen.com> 3;; Author: 1993 Barry A. Warsaw <bwarsaw@cnri.reston.va.us>
4;; Maintainer: bwarsaw@cen.com 4;; Maintainer: bwarsaw@cnri.reston.va.us
5;; Created: 19-Apr-1993 5;; Created: 19-Apr-1993
6;; Version: 2.12 6;; Version: 2.21
7;; Last Modified: 1994/07/06 14:55:39 7;; Last Modified: 1994/11/29 16:13:50
8;; Keywords: bug reports lisp 8;; Keywords: bug reports lisp
9 9
10;; Copyright (C) 1993 1994 Barry A. Warsaw 10;; Copyright (C) 1993 1994 Barry A. Warsaw
@@ -35,9 +35,9 @@
35;; set up a mail buffer with the appropriate bug report address, 35;; set up a mail buffer with the appropriate bug report address,
36;; including a lisp expression the maintainer of the package can eval 36;; including a lisp expression the maintainer of the package can eval
37;; to completely reproduce the environment in which the bug was 37;; to completely reproduce the environment in which the bug was
38;; observed (e.g. by using eval-last-sexp). This package proved especially 38;; observed (e.g. by using eval-last-sexp). This package proved
39;; useful during my development of cc-mode.el, which is highly dependent 39;; especially useful during my development of cc-mode.el, which is
40;; on its configuration variables. 40;; highly dependent on its configuration variables.
41;; 41;;
42;; Do a "C-h f reporter-submit-bug-report" for more information. 42;; Do a "C-h f reporter-submit-bug-report" for more information.
43;; Here's an example usage: 43;; Here's an example usage:
@@ -56,13 +56,6 @@
56;; ;; ... 56;; ;; ...
57;; 'mypkg-variable-last))) 57;; 'mypkg-variable-last)))
58 58
59;; Major differences since version 1:
60;; ==================================
61;; * More robust in the face of void variables
62;; * New interface controlling variable reporter-prompt-for-summary-p
63;; * pretty-printing of lists!
64
65
66;; Mailing List 59;; Mailing List
67;; ============ 60;; ============
68;; I've set up a mailing list to report bugs or suggest enhancements, 61;; I've set up a mailing list to report bugs or suggest enhancements,
@@ -73,10 +66,14 @@
73;; Administrivia: reporter-request@anthem.nlm.nih.gov 66;; Administrivia: reporter-request@anthem.nlm.nih.gov
74;; Submissions: reporter@anthem.nlm.nih.gov 67;; Submissions: reporter@anthem.nlm.nih.gov
75 68
69;; Packages that currently use reporter are: cc-mode, supercite, elp,
70;; tcl, ediff, crypt, vm, edebug, archie, and efs. If you know of
71;; others, please email me!
72
76;; LCD Archive Entry: 73;; LCD Archive Entry:
77;; reporter|Barry A. Warsaw|bwarsaw@cen.com| 74;; reporter|Barry A. Warsaw|bwarsaw@cnri.reston.va.us|
78;; Customizable bug reporting of lisp programs.| 75;; Customizable bug reporting of lisp programs.|
79;; 1994/07/06 14:55:39|2.12|~/misc/reporter.el.Z| 76;; 1994/11/29 16:13:50|2.21|~/misc/reporter.el.Z|
80 77
81;;; Code: 78;;; Code:
82 79
@@ -88,7 +85,9 @@
88 "*Mail package to use to generate bug report buffer. 85 "*Mail package to use to generate bug report buffer.
89This can either be a function symbol or a list of function symbols. 86This can either be a function symbol or a list of function symbols.
90If a list, it tries to use each specified mailer in order until an 87If a list, it tries to use each specified mailer in order until an
91existing one is found.") 88existing one is found.
89
90MH-E users may want to use `mh-smail'.")
92 91
93(defvar reporter-prompt-for-summary-p nil 92(defvar reporter-prompt-for-summary-p nil
94 "Interface variable controlling prompting for problem summary. 93 "Interface variable controlling prompting for problem summary.
@@ -101,6 +100,18 @@ prompt, you should `let' bind this variable to t before calling
101`reporter-submit-bug-report'. Note that this variable is not 100`reporter-submit-bug-report'. Note that this variable is not
102buffer-local so you should never just `setq' it.") 101buffer-local so you should never just `setq' it.")
103 102
103(defvar reporter-dont-compact-list nil
104 "Interface variable controlling compating of list values.
105When non-nil, this must be a list of variable symbols. When a
106variable containing a list value is formatted in the bug report mail
107buffer, it normally is compacted so that its value fits one the fewest
108number of lines. If the variable's symbol appears in this list, its
109value is printed in a more verbose style, specifically, one elemental
110sexp per line.
111
112Note that this variable is not buffer-local so you should never just
113`setq' it. If you want to changes its default value, you should `let'
114bind it.")
104 115
105;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 116;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106;; end of user defined variables 117;; end of user defined variables
@@ -111,24 +122,74 @@ This is necessary to properly support the printing of buffer-local
111variables. Current buffer will always be the mail buffer being 122variables. Current buffer will always be the mail buffer being
112composed.") 123composed.")
113 124
114(defconst reporter-version "2.12" 125(defconst reporter-version "2.21"
115 "Reporter version number.") 126 "Reporter version number.")
116 127
117(defvar reporter-initial-text nil 128(defvar reporter-initial-text nil
118 "The automatically created initial text of a bug report.") 129 "The automatically created initial text of a bug report.")
119(make-variable-buffer-local 'reporter-initial-text) 130(make-variable-buffer-local 'reporter-initial-text)
120 131
132
133(defvar reporter-status-message nil)
134(defvar reporter-status-count nil)
135
136(defun reporter-update-status ()
137 ;; periodically output a status message
138 (if (zerop (% reporter-status-count 10))
139 (progn
140 (message reporter-status-message)
141 (setq reporter-status-message (concat reporter-status-message "."))))
142 (setq reporter-status-count (1+ reporter-status-count)))
121 143
122 144
145(defun reporter-beautify-list (maxwidth compact-p)
146 ;; pretty print a list
147 (reporter-update-status)
148 (let (linebreak indent-enclosing-p indent-p here)
149 (condition-case nil ;loop exit
150 (progn
151 (down-list 1)
152 (setq indent-enclosing-p t)
153 (while t
154 (setq here (point))
155 (forward-sexp 1)
156 (if (<= maxwidth (current-column))
157 (if linebreak
158 (progn
159 (goto-char linebreak)
160 (newline-and-indent)
161 (setq linebreak nil))
162 (goto-char here)
163 (setq indent-p (reporter-beautify-list maxwidth compact-p))
164 (goto-char here)
165 (forward-sexp 1)
166 (if indent-p
167 (newline-and-indent))
168 t)
169 (if compact-p
170 (setq linebreak (point))
171 (newline-and-indent))
172 ))
173 t)
174 (error indent-enclosing-p))))
175
176(defun reporter-lisp-indent (indent-point state)
177 ;; a better lisp indentation style for bug reporting
178 (save-excursion
179 (goto-char (1+ (nth 1 state)))
180 (current-column)))
181
123(defun reporter-dump-variable (varsym mailbuf) 182(defun reporter-dump-variable (varsym mailbuf)
124 ;; Pretty-print the value of the variable in symbol VARSYM. MAILBUF 183 ;; Pretty-print the value of the variable in symbol VARSYM. MAILBUF
125 ;; is the mail buffer being composed 184 ;; is the mail buffer being composed
185 (reporter-update-status)
126 (condition-case nil 186 (condition-case nil
127 (let ((val (save-excursion 187 (let ((val (save-excursion
128 (set-buffer reporter-eval-buffer) 188 (set-buffer reporter-eval-buffer)
129 (symbol-value varsym))) 189 (symbol-value varsym)))
130 (sym (symbol-name varsym)) 190 (sym (symbol-name varsym))
131 (print-escape-newlines t) 191 (print-escape-newlines t)
192 (maxwidth (1- (window-width)))
132 (here (point))) 193 (here (point)))
133 (insert " " sym " " 194 (insert " " sym " "
134 (cond 195 (cond
@@ -137,36 +198,17 @@ composed.")
137 ((symbolp val) "'") 198 ((symbolp val) "'")
138 (t "")) 199 (t ""))
139 (prin1-to-string val)) 200 (prin1-to-string val))
201 (lisp-indent-line)
140 ;; clean up lists, but only if the line as printed was long 202 ;; clean up lists, but only if the line as printed was long
141 ;; enough to wrap 203 ;; enough to wrap
142 (if (and (listp val) 204 (if (and val ;nil is a list, but short
143 (< (window-width) (current-column))) 205 (listp val)
206 (<= maxwidth (current-column)))
144 (save-excursion 207 (save-excursion
145 (goto-char here) 208 (let ((compact-p (not (memq varsym reporter-dont-compact-list)))
146 ;; skip past the symbol name 209 (lisp-indent-function 'reporter-lisp-indent))
147 (down-list 1) 210 (goto-char here)
148 (condition-case nil ; actual loop exit 211 (reporter-beautify-list maxwidth compact-p))))
149 (while t
150 (forward-sexp 1)
151 (insert "\n")
152 ;; if the sexp is longer than a single line then
153 ;; fill it to fill-column
154 (if (< (window-width)
155 (save-excursion
156 (forward-char -1)
157 (current-column)))
158 (let (stop)
159 (unwind-protect
160 (setq stop (point-marker))
161 (forward-line -1)
162 (fill-region (point) (progn (end-of-line)
163 (point)))
164 ;; consume extra newline left by fill-region
165 (delete-char 1)
166 (goto-char stop))
167 (set-marker stop nil)))
168 (lisp-indent-line))
169 (error nil))))
170 (insert "\n")) 212 (insert "\n"))
171 (void-variable 213 (void-variable
172 (save-excursion 214 (save-excursion
@@ -230,9 +272,8 @@ composed.")
230 (funcall printer varsym mailbuf) 272 (funcall printer varsym mailbuf)
231 ))) 273 )))
232 varlist) 274 varlist)
233 (insert ")\n") 275 (lisp-indent-line)
234 (beginning-of-defun) 276 (insert ")\n"))
235 (indent-sexp))
236 (insert-buffer elbuf)) 277 (insert-buffer elbuf))
237 (error 278 (error
238 (insert "State could not be dumped due to the following error:\n\n" 279 (insert "State could not be dumped due to the following error:\n\n"
@@ -279,6 +320,8 @@ composed.")
279 (let ((reporter-eval-buffer (current-buffer)) 320 (let ((reporter-eval-buffer (current-buffer))
280 final-resting-place 321 final-resting-place
281 after-sep-pos 322 after-sep-pos
323 (reporter-status-message "Formatting bug report buffer...")
324 (reporter-status-count 0)
282 (problem (and reporter-prompt-for-summary-p 325 (problem (and reporter-prompt-for-summary-p
283 (read-string "(Very) brief summary of problem: "))) 326 (read-string "(Very) brief summary of problem: ")))
284 (mailbuf 327 (mailbuf
@@ -313,7 +356,8 @@ composed.")
313 (progn 356 (progn
314 (mail-position-on-field "subject") 357 (mail-position-on-field "subject")
315 (insert pkgname "; " problem))) 358 (insert pkgname "; " problem)))
316 (re-search-forward mail-header-separator (point-max) 'move) 359 ;; move point to the body of the message
360 (mail-text)
317 (forward-line 1) 361 (forward-line 1)
318 (setq after-sep-pos (point)) 362 (setq after-sep-pos (point))
319 (and salutation (insert "\n" salutation "\n\n")) 363 (and salutation (insert "\n" salutation "\n\n"))