changeset 3903:a1a2b1ee2554

entered into RCS
author Richard M. Stallman <rms@gnu.org>
date Sat, 26 Jun 1993 11:59:44 +0000
parents 717f2e24975e
children 6c98b9e2a213
files lisp/mail/reporter.el
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/reporter.el	Sat Jun 26 04:20:42 1993 +0000
+++ b/lisp/mail/reporter.el	Sat Jun 26 11:59:44 1993 +0000
@@ -1,14 +1,11 @@
 ;;; reporter.el --- customizable bug reporting of lisp programs
+;; Copyright (C) 1993 Free Software Foundation, Inc.
 
 ;; Author: 1993 Barry A. Warsaw, Century Computing Inc. <bwarsaw@cen.com>
 ;; Maintainer:      bwarsaw@cen.com
 ;; Created:         19-Apr-1993
-;; Version:         1.18
-;; Last Modified:   1993/05/22 00:29:49
 ;; Keywords: bug reports lisp
 
-;; Copyright (C) 1993 Free Software Foundation, Inc.
-
 ;; This file is not yet part of GNU Emacs.
 ;;
 ;; This program is free software; you can redistribute it and/or modify
@@ -81,10 +78,17 @@
 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ;; end of user defined variables
 
+(defvar reporter-eval-buffer nil
+  "Buffer to retrieve variable's value from.
+This is necessary to properly support the printing of buffer-local
+variables.  Current buffer will always be the mail buffer being
+composed.")
 
 (defun reporter-dump-variable (varsym)
   "Pretty-print the value of the variable in symbol VARSYM."
-  (let ((val (eval varsym))
+  (let ((val (save-excursion
+	       (set-buffer reporter-eval-buffer)
+	       (eval varsym)))
 	(sym (symbol-name varsym))
 	(print-escape-newlines t))
     (insert "     " sym " "
@@ -108,6 +112,13 @@
 a function which will be `funcall'd with the symbol. Use this to write
 your own custom variable value printers for specific variables.
 
+Note that the global variable `reporter-eval-buffer' will be bound to
+the buffer in which `reporter-submit-bug-report' was invoked.  If you
+want to print the value of a buffer local variable, you should wrap
+the `eval' call in your custom printer inside a `set-buffer' (and
+probably a `save-excursion'). `reporter-dump-variable' handles this
+properly.
+
 PRE-HOOKS is run after the emacs-version and PKGNAME are inserted, but
 before the VARLIST is dumped.  POST-HOOKS is run after the VARLIST is
 dumped."
@@ -143,11 +154,11 @@
 
 The mailer used is described in the variable `reporter-mailer'."
 
-  (let ((curbuf (current-buffer))
+  (let ((reporter-eval-buffer (current-buffer))
 	(mailbuf (progn (call-interactively reporter-mailer)
 			(current-buffer))))
     (require 'sendmail)
-    (pop-to-buffer curbuf)
+    (pop-to-buffer reporter-eval-buffer)
     (pop-to-buffer mailbuf)
     (goto-char (point-min))
     ;; different mailers use different separators, some may not even