comparison lisp/mail/reporter.el @ 3903:a1a2b1ee2554

entered into RCS
author Richard M. Stallman <rms@gnu.org>
date Sat, 26 Jun 1993 11:59:44 +0000
parents 6af3ae2976d0
children 4df93ff816c4
comparison
equal deleted inserted replaced
3902:717f2e24975e 3903:a1a2b1ee2554
1 ;;; reporter.el --- customizable bug reporting of lisp programs 1 ;;; reporter.el --- customizable bug reporting of lisp programs
2 ;; Copyright (C) 1993 Free Software Foundation, Inc.
2 3
3 ;; Author: 1993 Barry A. Warsaw, Century Computing Inc. <bwarsaw@cen.com> 4 ;; Author: 1993 Barry A. Warsaw, Century Computing Inc. <bwarsaw@cen.com>
4 ;; Maintainer: bwarsaw@cen.com 5 ;; Maintainer: bwarsaw@cen.com
5 ;; Created: 19-Apr-1993 6 ;; Created: 19-Apr-1993
6 ;; Version: 1.18
7 ;; Last Modified: 1993/05/22 00:29:49
8 ;; Keywords: bug reports lisp 7 ;; Keywords: bug reports lisp
9
10 ;; Copyright (C) 1993 Free Software Foundation, Inc.
11 8
12 ;; This file is not yet part of GNU Emacs. 9 ;; This file is not yet part of GNU Emacs.
13 ;; 10 ;;
14 ;; This program is free software; you can redistribute it and/or modify 11 ;; This program is free software; you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by 12 ;; it under the terms of the GNU General Public License as published by
79 "*Mail package to use to generate bug report buffer.") 76 "*Mail package to use to generate bug report buffer.")
80 77
81 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 78 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82 ;; end of user defined variables 79 ;; end of user defined variables
83 80
81 (defvar reporter-eval-buffer nil
82 "Buffer to retrieve variable's value from.
83 This is necessary to properly support the printing of buffer-local
84 variables. Current buffer will always be the mail buffer being
85 composed.")
84 86
85 (defun reporter-dump-variable (varsym) 87 (defun reporter-dump-variable (varsym)
86 "Pretty-print the value of the variable in symbol VARSYM." 88 "Pretty-print the value of the variable in symbol VARSYM."
87 (let ((val (eval varsym)) 89 (let ((val (save-excursion
90 (set-buffer reporter-eval-buffer)
91 (eval varsym)))
88 (sym (symbol-name varsym)) 92 (sym (symbol-name varsym))
89 (print-escape-newlines t)) 93 (print-escape-newlines t))
90 (insert " " sym " " 94 (insert " " sym " "
91 (cond 95 (cond
92 ((memq val '(t nil)) "") 96 ((memq val '(t nil)) "")
105 be a variable symbol, or a cons cell. If a symbol, this will be 109 be a variable symbol, or a cons cell. If a symbol, this will be
106 passed to `reporter-dump-variable' for insertion into the mail buffer. 110 passed to `reporter-dump-variable' for insertion into the mail buffer.
107 If a cons cell, the car must be a variable symbol and the cdr must be 111 If a cons cell, the car must be a variable symbol and the cdr must be
108 a function which will be `funcall'd with the symbol. Use this to write 112 a function which will be `funcall'd with the symbol. Use this to write
109 your own custom variable value printers for specific variables. 113 your own custom variable value printers for specific variables.
114
115 Note that the global variable `reporter-eval-buffer' will be bound to
116 the buffer in which `reporter-submit-bug-report' was invoked. If you
117 want to print the value of a buffer local variable, you should wrap
118 the `eval' call in your custom printer inside a `set-buffer' (and
119 probably a `save-excursion'). `reporter-dump-variable' handles this
120 properly.
110 121
111 PRE-HOOKS is run after the emacs-version and PKGNAME are inserted, but 122 PRE-HOOKS is run after the emacs-version and PKGNAME are inserted, but
112 before the VARLIST is dumped. POST-HOOKS is run after the VARLIST is 123 before the VARLIST is dumped. POST-HOOKS is run after the VARLIST is
113 dumped." 124 dumped."
114 (let ((buffer (current-buffer))) 125 (let ((buffer (current-buffer)))
141 `reporter-dump-state'. Optional SALUTATION is inserted at the top of the 152 `reporter-dump-state'. Optional SALUTATION is inserted at the top of the
142 mail buffer, and point is left after the salutation. 153 mail buffer, and point is left after the salutation.
143 154
144 The mailer used is described in the variable `reporter-mailer'." 155 The mailer used is described in the variable `reporter-mailer'."
145 156
146 (let ((curbuf (current-buffer)) 157 (let ((reporter-eval-buffer (current-buffer))
147 (mailbuf (progn (call-interactively reporter-mailer) 158 (mailbuf (progn (call-interactively reporter-mailer)
148 (current-buffer)))) 159 (current-buffer))))
149 (require 'sendmail) 160 (require 'sendmail)
150 (pop-to-buffer curbuf) 161 (pop-to-buffer reporter-eval-buffer)
151 (pop-to-buffer mailbuf) 162 (pop-to-buffer mailbuf)
152 (goto-char (point-min)) 163 (goto-char (point-min))
153 ;; different mailers use different separators, some may not even 164 ;; different mailers use different separators, some may not even
154 ;; use m-h-s, but sendmail.el stuff must have m-h-s bound. 165 ;; use m-h-s, but sendmail.el stuff must have m-h-s bound.
155 (let ((mail-header-separator 166 (let ((mail-header-separator