Function: reporter-dump-state

reporter-dump-state is a byte-compiled function defined in reporter.el.gz.

Signature

(reporter-dump-state PKGNAME VARLIST PRE-HOOKS POST-HOOKS)

Documentation

Dump the state of the mode specific variables.

PKGNAME contains the name of the mode as it will appear in the bug report (you must explicitly concat any version numbers).

VARLIST is the list of variables to dump. Each element in VARLIST can be a variable symbol, or a cons cell. If a symbol, this will be passed to reporter-dump-variable for insertion into the mail buffer. If a cons cell, the car must be a variable symbol and the cdr must be a function which will be funcalld with arguments the symbol and the mail buffer being composed. 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.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/reporter.el.gz
(defun reporter-dump-state (pkgname varlist pre-hooks post-hooks)
  "Dump the state of the mode specific variables.
PKGNAME contains the name of the mode as it will appear in the bug
report (you must explicitly concat any version numbers).

VARLIST is the list of variables to dump.  Each element in
VARLIST can be a variable symbol, or a cons cell.  If a symbol,
this will be passed to `reporter-dump-variable' for insertion
into the mail buffer.  If a cons cell, the car must be a variable
symbol and the cdr must be a function which will be `funcall'd
with arguments the symbol and the mail buffer being composed.  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."
  (insert "Emacs  : " (emacs-version) "\n")
  (and pkgname
       (insert "Package: " pkgname "\n"))
  (reporter--run-functions pre-hooks)
  (if (not varlist)
      nil
    (insert "\ncurrent state:\n==============\n")
    ;; create an emacs-lisp-mode buffer to contain the output, which
    ;; we'll later insert into the mail buffer
    (condition-case fault
	(let ((mailbuf (current-buffer))
	      (elbuf (get-buffer-create " *tmp-reporter-buffer*")))
	  (with-current-buffer elbuf
	    (emacs-lisp-mode)
	    (erase-buffer)
	    (insert "(setq\n")
	    (lisp-indent-line)
	    (mapc
             (lambda (varsym-or-cons-cell)
               (let ((varsym (or (car-safe varsym-or-cons-cell)
                                 varsym-or-cons-cell))
                     (printer (or (cdr-safe varsym-or-cons-cell)
                                  'reporter-dump-variable)))
                 (funcall printer varsym mailbuf)))
	     varlist)
	    (lisp-indent-line)
	    (insert ")\n"))
	  (insert-buffer-substring elbuf))
      (error
       (insert "State could not be dumped due to the following error:\n\n"
	       (format "%s" fault)
	       "\n\nYou should still send this bug report."))))
  (reporter--run-functions post-hooks))