1993-06-01 22:26:20 +00:00
|
|
|
|
;;; reporter.el --- customizable bug reporting of lisp programs
|
|
|
|
|
|
2015-01-01 14:26:41 -08:00
|
|
|
|
;; Copyright (C) 1993-1998, 2001-2015 Free Software Foundation, Inc.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
|
1998-03-20 06:37:09 +00:00
|
|
|
|
;; Author: 1993-1998 Barry A. Warsaw
|
2014-02-09 17:34:22 -08:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1993-06-01 22:26:20 +00:00
|
|
|
|
;; Created: 19-Apr-1993
|
1996-07-03 01:30:24 +00:00
|
|
|
|
;; Keywords: maint mail tools
|
1993-06-01 22:26:20 +00:00
|
|
|
|
|
1993-10-09 20:00:23 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
1993-10-18 05:37:51 +00:00
|
|
|
|
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1993-06-01 22:26:20 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1993-10-18 05:37:51 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
1993-06-01 22:26:20 +00:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
1993-10-18 05:37:51 +00:00
|
|
|
|
|
1993-06-01 22:26:20 +00:00
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1993-06-01 22:26:20 +00:00
|
|
|
|
|
1994-07-18 18:49:25 +00:00
|
|
|
|
;;; Commentary:
|
1996-01-14 07:34:30 +00:00
|
|
|
|
|
1996-07-03 01:30:24 +00:00
|
|
|
|
;; End User Interface
|
|
|
|
|
;; ==================
|
|
|
|
|
;; The variable `mail-user-agent' contains a symbol indicating which
|
|
|
|
|
;; Emacs mail package end users would like to use to compose outgoing
|
1998-03-20 06:37:09 +00:00
|
|
|
|
;; mail. See that variable for details (it is no longer defined in
|
|
|
|
|
;; this file).
|
1996-07-03 01:30:24 +00:00
|
|
|
|
|
|
|
|
|
;; Lisp Package Authors
|
|
|
|
|
;; ====================
|
1998-03-20 06:37:09 +00:00
|
|
|
|
;; reporter.el was written primarily for Emacs Lisp package authors so
|
|
|
|
|
;; that their users can more easily report bugs. When invoked,
|
|
|
|
|
;; `reporter-submit-bug-report' will set up an outgoing mail buffer
|
|
|
|
|
;; with the appropriate bug report address, including a lisp
|
|
|
|
|
;; expression the maintainer of the package can evaluate to completely
|
|
|
|
|
;; reproduce the environment in which the bug was observed (e.g. by
|
|
|
|
|
;; using `eval-last-sexp'). This package proved especially useful
|
|
|
|
|
;; during my development of CC Mode, which is highly dependent on its
|
1996-07-03 01:30:24 +00:00
|
|
|
|
;; configuration variables.
|
1993-06-01 22:26:20 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Do a "C-h f reporter-submit-bug-report" for more information.
|
|
|
|
|
;; Here's an example usage:
|
|
|
|
|
;;
|
1994-07-18 18:49:25 +00:00
|
|
|
|
;;(defconst mypkg-version "9.801")
|
|
|
|
|
;;(defconst mypkg-maintainer-address "mypkg-help@foo.com")
|
|
|
|
|
;;(defun mypkg-submit-bug-report ()
|
|
|
|
|
;; "Submit via mail a bug report on mypkg"
|
|
|
|
|
;; (interactive)
|
1998-03-20 06:37:09 +00:00
|
|
|
|
;; (require 'reporter)
|
1994-07-18 18:49:25 +00:00
|
|
|
|
;; (reporter-submit-bug-report
|
|
|
|
|
;; mypkg-maintainer-address
|
|
|
|
|
;; (concat "mypkg.el " mypkg-version)
|
|
|
|
|
;; (list 'mypkg-variable-1
|
|
|
|
|
;; 'mypkg-variable-2
|
|
|
|
|
;; ;; ...
|
|
|
|
|
;; 'mypkg-variable-last)))
|
|
|
|
|
|
1996-08-29 21:37:52 +00:00
|
|
|
|
;;; Code:
|
1996-07-03 01:30:24 +00:00
|
|
|
|
|
1998-03-20 06:37:09 +00:00
|
|
|
|
|
1996-06-28 06:51:32 +00:00
|
|
|
|
;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
|
|
|
|
;; Package author interface variables
|
|
|
|
|
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(defvar reporter-prompt-for-summary-p nil
|
|
|
|
|
"Interface variable controlling prompting for problem summary.
|
|
|
|
|
When non-nil, `reporter-submit-bug-report' prompts the user for a
|
|
|
|
|
brief summary of the problem, and puts this summary on the Subject:
|
1996-07-03 01:30:24 +00:00
|
|
|
|
line. If this variable is a string, that string is used as the prompt
|
|
|
|
|
string.
|
1994-07-18 18:49:25 +00:00
|
|
|
|
|
2000-05-26 13:06:25 +00:00
|
|
|
|
Default behavior is to not prompt (i.e. nil). If you want reporter to
|
1996-07-03 01:30:24 +00:00
|
|
|
|
prompt, you should `let' bind this variable before calling
|
1994-07-18 18:49:25 +00:00
|
|
|
|
`reporter-submit-bug-report'. Note that this variable is not
|
|
|
|
|
buffer-local so you should never just `setq' it.")
|
|
|
|
|
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(defvar reporter-dont-compact-list nil
|
1996-01-04 23:47:56 +00:00
|
|
|
|
"Interface variable controlling compacting of list values.
|
1994-12-23 17:33:21 +00:00
|
|
|
|
When non-nil, this must be a list of variable symbols. When a
|
|
|
|
|
variable containing a list value is formatted in the bug report mail
|
|
|
|
|
buffer, it normally is compacted so that its value fits one the fewest
|
|
|
|
|
number of lines. If the variable's symbol appears in this list, its
|
|
|
|
|
value is printed in a more verbose style, specifically, one elemental
|
|
|
|
|
sexp per line.
|
|
|
|
|
|
|
|
|
|
Note that this variable is not buffer-local so you should never just
|
|
|
|
|
`setq' it. If you want to changes its default value, you should `let'
|
|
|
|
|
bind it.")
|
1993-06-01 22:26:20 +00:00
|
|
|
|
|
1996-07-03 01:30:24 +00:00
|
|
|
|
;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
1996-06-28 06:51:32 +00:00
|
|
|
|
;; End of editable variables
|
|
|
|
|
|
1996-07-03 01:30:24 +00:00
|
|
|
|
|
1993-06-26 11:59:44 +00:00
|
|
|
|
(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.")
|
1993-10-18 05:37:51 +00:00
|
|
|
|
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(defvar reporter-initial-text nil
|
|
|
|
|
"The automatically created initial text of a bug report.")
|
|
|
|
|
(make-variable-buffer-local 'reporter-initial-text)
|
|
|
|
|
|
1996-07-03 01:30:24 +00:00
|
|
|
|
|
1994-12-23 17:33:21 +00:00
|
|
|
|
|
1996-07-03 01:30:24 +00:00
|
|
|
|
;; status feedback to the user
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(defvar reporter-status-message nil)
|
|
|
|
|
(defvar reporter-status-count nil)
|
|
|
|
|
|
|
|
|
|
(defun reporter-update-status ()
|
2000-05-26 13:06:25 +00:00
|
|
|
|
"Periodically output a status message."
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(if (zerop (% reporter-status-count 10))
|
|
|
|
|
(progn
|
2007-12-08 01:02:29 +00:00
|
|
|
|
(message "%s" reporter-status-message)
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(setq reporter-status-message (concat reporter-status-message "."))))
|
|
|
|
|
(setq reporter-status-count (1+ reporter-status-count)))
|
1994-07-18 18:49:25 +00:00
|
|
|
|
|
1993-06-01 22:26:20 +00:00
|
|
|
|
|
1996-07-03 01:30:24 +00:00
|
|
|
|
;; dumping/pretty printing of values
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(defun reporter-beautify-list (maxwidth compact-p)
|
2000-05-26 13:06:25 +00:00
|
|
|
|
"Pretty print a list."
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(reporter-update-status)
|
1998-03-20 06:37:09 +00:00
|
|
|
|
(let ((move t)
|
|
|
|
|
linebreak indent-enclosing-p indent-p here)
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(condition-case nil ;loop exit
|
|
|
|
|
(progn
|
|
|
|
|
(down-list 1)
|
|
|
|
|
(setq indent-enclosing-p t)
|
1998-03-20 06:37:09 +00:00
|
|
|
|
(while move
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(setq here (point))
|
1998-03-20 06:37:09 +00:00
|
|
|
|
;; The following line is how we break out of the while
|
|
|
|
|
;; loop, in one of two ways. Either we've hit the end of
|
|
|
|
|
;; the buffer, in which case scan-sexps returns nil, or
|
|
|
|
|
;; we've crossed unbalanced parens and it will raise an
|
|
|
|
|
;; error we're expecting to catch.
|
|
|
|
|
(setq move (scan-sexps (point) 1))
|
|
|
|
|
(goto-char move)
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(if (<= maxwidth (current-column))
|
|
|
|
|
(if linebreak
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char linebreak)
|
|
|
|
|
(newline-and-indent)
|
|
|
|
|
(setq linebreak nil))
|
|
|
|
|
(goto-char here)
|
|
|
|
|
(setq indent-p (reporter-beautify-list maxwidth compact-p))
|
|
|
|
|
(goto-char here)
|
|
|
|
|
(forward-sexp 1)
|
|
|
|
|
(if indent-p
|
|
|
|
|
(newline-and-indent))
|
|
|
|
|
t)
|
|
|
|
|
(if compact-p
|
|
|
|
|
(setq linebreak (point))
|
|
|
|
|
(newline-and-indent))
|
|
|
|
|
))
|
|
|
|
|
t)
|
|
|
|
|
(error indent-enclosing-p))))
|
|
|
|
|
|
|
|
|
|
(defun reporter-lisp-indent (indent-point state)
|
2000-05-26 13:06:25 +00:00
|
|
|
|
"A better lisp indentation style for bug reporting."
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (1+ (nth 1 state)))
|
|
|
|
|
(current-column)))
|
|
|
|
|
|
2007-11-25 16:48:31 +00:00
|
|
|
|
(declare-function mail-position-on-field "sendmail" (field &optional soft))
|
|
|
|
|
(declare-function mail-text "sendmail" ())
|
|
|
|
|
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(defun reporter-dump-variable (varsym mailbuf)
|
2000-05-26 13:06:25 +00:00
|
|
|
|
"Pretty-print the value of the variable in symbol VARSYM.
|
|
|
|
|
MAILBUF is the mail buffer being composed."
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(reporter-update-status)
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(condition-case nil
|
* url-util.el (url-insert-entities-in-string):
* url-nfs.el (url-nfs-unescape):
* url-ldap.el (url-ldap):
* url-imap.el (url-imap):
* url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer.
* erc.el (erc-display-line-1, erc-process-away):
* erc-truncate.el (erc-truncate-buffer-to-size):
Use with-current-buffer.
* term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos):
* play/mpuz.el (mpuz-create-buffer):
* play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell)
(lm-print-y,s,noise, lm-print-w0, lm-init):
* play/gomoku.el (gomoku-prompt-for-move):
* play/fortune.el (fortune-in-buffer):
* play/dissociate.el (dissociated-press):
* play/decipher.el (decipher-adjacency-list, decipher-display-regexp)
(decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer):
* mail/supercite.el (sc-eref-show):
* mail/smtpmail.el (smtpmail-send-it):
* mail/rmailsum.el (rmail-summary-next-labeled-message)
(rmail-summary-previous-labeled-message, rmail-summary-wipe)
(rmail-summary-undelete-many, rmail-summary-rmail-update)
(rmail-summary-goto-msg, rmail-summary-expunge)
(rmail-summary-get-new-mail, rmail-summary-search-backward)
(rmail-summary-add-label, rmail-summary-output-menu)
(rmail-summary-output-body):
* mail/rfc822.el (rfc822-addresses):
* mail/reporter.el (reporter-dump-variable, reporter-dump-state):
* mail/mailpost.el (post-mail-send-it):
* mail/hashcash.el (hashcash-generate-payment):
* mail/feedmail.el (feedmail-run-the-queue)
(feedmail-queue-send-edit-prompt-help-first)
(feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater)
(feedmail-deduce-address-list):
* eshell/esh-ext.el (eshell-remote-command):
* eshell/em-unix.el (eshell-occur-mode-mouse-goto):
* emulation/viper-util.el (viper-glob-unix-files, viper-save-setting)
(viper-wildcard-to-regexp, viper-glob-mswindows-files)
(viper-save-string-in-file, viper-valid-marker):
* emulation/viper-keym.el (viper-toggle-key):
* emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file)
(ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit)
(ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile):
* emulation/viper-cmd.el (viper-exec-form-in-vi)
(viper-exec-form-in-emacs, viper-brac-function):
* emulation/viper.el (viper-delocalize-var):
* emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat)
(vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer)
(vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark)
(ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command):
* emulation/vi.el (vi-switch-mode, vi-ex-cmd):
* emulation/edt.el (edt-electric-helpify):
* emulation/cua-rect.el (cua--rectangle-aux-replace):
* emulation/cua-gmrk.el (cua--insert-at-global-mark)
(cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark)
(cua-indent-to-global-mark-column):
* calendar/diary-lib.el (calendar-mark-1):
* calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern):
Use with-current-buffer.
* emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
|
|
|
|
(let ((val (with-current-buffer reporter-eval-buffer
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(symbol-value varsym)))
|
|
|
|
|
(sym (symbol-name varsym))
|
|
|
|
|
(print-escape-newlines t)
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(maxwidth (1- (window-width)))
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(here (point)))
|
|
|
|
|
(insert " " sym " "
|
|
|
|
|
(cond
|
|
|
|
|
((memq val '(t nil)) "")
|
|
|
|
|
((listp val) "'")
|
|
|
|
|
((symbolp val) "'")
|
|
|
|
|
(t ""))
|
|
|
|
|
(prin1-to-string val))
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(lisp-indent-line)
|
1994-07-18 18:49:25 +00:00
|
|
|
|
;; clean up lists, but only if the line as printed was long
|
|
|
|
|
;; enough to wrap
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(if (and val ;nil is a list, but short
|
|
|
|
|
(listp val)
|
|
|
|
|
(<= maxwidth (current-column)))
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(save-excursion
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(let ((compact-p (not (memq varsym reporter-dont-compact-list)))
|
|
|
|
|
(lisp-indent-function 'reporter-lisp-indent))
|
|
|
|
|
(goto-char here)
|
|
|
|
|
(reporter-beautify-list maxwidth compact-p))))
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(insert "\n"))
|
|
|
|
|
(void-variable
|
* url-util.el (url-insert-entities-in-string):
* url-nfs.el (url-nfs-unescape):
* url-ldap.el (url-ldap):
* url-imap.el (url-imap):
* url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer.
* erc.el (erc-display-line-1, erc-process-away):
* erc-truncate.el (erc-truncate-buffer-to-size):
Use with-current-buffer.
* term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos):
* play/mpuz.el (mpuz-create-buffer):
* play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell)
(lm-print-y,s,noise, lm-print-w0, lm-init):
* play/gomoku.el (gomoku-prompt-for-move):
* play/fortune.el (fortune-in-buffer):
* play/dissociate.el (dissociated-press):
* play/decipher.el (decipher-adjacency-list, decipher-display-regexp)
(decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer):
* mail/supercite.el (sc-eref-show):
* mail/smtpmail.el (smtpmail-send-it):
* mail/rmailsum.el (rmail-summary-next-labeled-message)
(rmail-summary-previous-labeled-message, rmail-summary-wipe)
(rmail-summary-undelete-many, rmail-summary-rmail-update)
(rmail-summary-goto-msg, rmail-summary-expunge)
(rmail-summary-get-new-mail, rmail-summary-search-backward)
(rmail-summary-add-label, rmail-summary-output-menu)
(rmail-summary-output-body):
* mail/rfc822.el (rfc822-addresses):
* mail/reporter.el (reporter-dump-variable, reporter-dump-state):
* mail/mailpost.el (post-mail-send-it):
* mail/hashcash.el (hashcash-generate-payment):
* mail/feedmail.el (feedmail-run-the-queue)
(feedmail-queue-send-edit-prompt-help-first)
(feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater)
(feedmail-deduce-address-list):
* eshell/esh-ext.el (eshell-remote-command):
* eshell/em-unix.el (eshell-occur-mode-mouse-goto):
* emulation/viper-util.el (viper-glob-unix-files, viper-save-setting)
(viper-wildcard-to-regexp, viper-glob-mswindows-files)
(viper-save-string-in-file, viper-valid-marker):
* emulation/viper-keym.el (viper-toggle-key):
* emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file)
(ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit)
(ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile):
* emulation/viper-cmd.el (viper-exec-form-in-vi)
(viper-exec-form-in-emacs, viper-brac-function):
* emulation/viper.el (viper-delocalize-var):
* emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat)
(vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer)
(vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark)
(ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command):
* emulation/vi.el (vi-switch-mode, vi-ex-cmd):
* emulation/edt.el (edt-electric-helpify):
* emulation/cua-rect.el (cua--rectangle-aux-replace):
* emulation/cua-gmrk.el (cua--insert-at-global-mark)
(cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark)
(cua-indent-to-global-mark-column):
* calendar/diary-lib.el (calendar-mark-1):
* calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern):
Use with-current-buffer.
* emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
|
|
|
|
(with-current-buffer mailbuf
|
2014-01-30 21:39:40 -05:00
|
|
|
|
(save-excursion
|
|
|
|
|
(mail-position-on-field "X-Reporter-Void-Vars-Found")
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(insert (symbol-name varsym) " "))))
|
1996-07-03 01:30:24 +00:00
|
|
|
|
(error
|
|
|
|
|
(error ""))))
|
1993-06-01 22:26:20 +00:00
|
|
|
|
|
|
|
|
|
(defun reporter-dump-state (pkgname varlist pre-hooks post-hooks)
|
2000-05-26 13:06:25 +00:00
|
|
|
|
"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."
|
1993-06-01 22:26:20 +00:00
|
|
|
|
(let ((buffer (current-buffer)))
|
|
|
|
|
(set-buffer buffer)
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(insert "Emacs : " (emacs-version) "\n")
|
|
|
|
|
(and pkgname
|
|
|
|
|
(insert "Package: " pkgname "\n"))
|
1993-06-01 22:26:20 +00:00
|
|
|
|
(run-hooks 'pre-hooks)
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(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*")))
|
* url-util.el (url-insert-entities-in-string):
* url-nfs.el (url-nfs-unescape):
* url-ldap.el (url-ldap):
* url-imap.el (url-imap):
* url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer.
* erc.el (erc-display-line-1, erc-process-away):
* erc-truncate.el (erc-truncate-buffer-to-size):
Use with-current-buffer.
* term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos):
* play/mpuz.el (mpuz-create-buffer):
* play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell)
(lm-print-y,s,noise, lm-print-w0, lm-init):
* play/gomoku.el (gomoku-prompt-for-move):
* play/fortune.el (fortune-in-buffer):
* play/dissociate.el (dissociated-press):
* play/decipher.el (decipher-adjacency-list, decipher-display-regexp)
(decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer):
* mail/supercite.el (sc-eref-show):
* mail/smtpmail.el (smtpmail-send-it):
* mail/rmailsum.el (rmail-summary-next-labeled-message)
(rmail-summary-previous-labeled-message, rmail-summary-wipe)
(rmail-summary-undelete-many, rmail-summary-rmail-update)
(rmail-summary-goto-msg, rmail-summary-expunge)
(rmail-summary-get-new-mail, rmail-summary-search-backward)
(rmail-summary-add-label, rmail-summary-output-menu)
(rmail-summary-output-body):
* mail/rfc822.el (rfc822-addresses):
* mail/reporter.el (reporter-dump-variable, reporter-dump-state):
* mail/mailpost.el (post-mail-send-it):
* mail/hashcash.el (hashcash-generate-payment):
* mail/feedmail.el (feedmail-run-the-queue)
(feedmail-queue-send-edit-prompt-help-first)
(feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater)
(feedmail-deduce-address-list):
* eshell/esh-ext.el (eshell-remote-command):
* eshell/em-unix.el (eshell-occur-mode-mouse-goto):
* emulation/viper-util.el (viper-glob-unix-files, viper-save-setting)
(viper-wildcard-to-regexp, viper-glob-mswindows-files)
(viper-save-string-in-file, viper-valid-marker):
* emulation/viper-keym.el (viper-toggle-key):
* emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file)
(ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit)
(ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile):
* emulation/viper-cmd.el (viper-exec-form-in-vi)
(viper-exec-form-in-emacs, viper-brac-function):
* emulation/viper.el (viper-delocalize-var):
* emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat)
(vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer)
(vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark)
(ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command):
* emulation/vi.el (vi-switch-mode, vi-ex-cmd):
* emulation/edt.el (edt-electric-helpify):
* emulation/cua-rect.el (cua--rectangle-aux-replace):
* emulation/cua-gmrk.el (cua--insert-at-global-mark)
(cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark)
(cua-indent-to-global-mark-column):
* calendar/diary-lib.el (calendar-mark-1):
* calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern):
Use with-current-buffer.
* emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
|
|
|
|
(with-current-buffer elbuf
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(emacs-lisp-mode)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert "(setq\n")
|
|
|
|
|
(lisp-indent-line)
|
2007-10-13 03:03:35 +00:00
|
|
|
|
(mapc
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(function
|
|
|
|
|
(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)
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(lisp-indent-line)
|
|
|
|
|
(insert ")\n"))
|
2005-08-09 02:57:09 +00:00
|
|
|
|
(insert-buffer-substring elbuf))
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(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."))))
|
1993-06-01 22:26:20 +00:00
|
|
|
|
(run-hooks 'post-hooks)
|
|
|
|
|
))
|
|
|
|
|
|
1996-07-03 01:30:24 +00:00
|
|
|
|
|
|
|
|
|
(defun reporter-compose-outgoing ()
|
2000-05-26 13:06:25 +00:00
|
|
|
|
"Compose the outgoing mail buffer.
|
|
|
|
|
|
|
|
|
|
Return the selected paradigm, with the current buffer tacked onto the
|
|
|
|
|
beginning of the list."
|
1996-07-03 01:30:24 +00:00
|
|
|
|
(let* ((agent mail-user-agent)
|
|
|
|
|
(compose (get mail-user-agent 'composefunc)))
|
|
|
|
|
;; Sanity check. If this fails then we'll try to use the SENDMAIL
|
|
|
|
|
;; protocol, otherwise we must signal an error.
|
1998-03-29 02:35:51 +00:00
|
|
|
|
(if (not (and compose (functionp compose)))
|
1996-07-03 01:30:24 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setq agent 'sendmail-user-agent
|
|
|
|
|
compose (get agent 'composefunc))
|
1998-03-29 02:35:51 +00:00
|
|
|
|
(if (not (and compose (functionp compose)))
|
1996-08-29 21:37:52 +00:00
|
|
|
|
(error "Could not find a valid `mail-user-agent'")
|
1996-07-03 01:30:24 +00:00
|
|
|
|
(ding)
|
1996-08-29 21:37:52 +00:00
|
|
|
|
(message "`%s' is an invalid `mail-user-agent'; using `sendmail-user-agent'"
|
1996-07-03 01:30:24 +00:00
|
|
|
|
mail-user-agent)
|
|
|
|
|
)))
|
|
|
|
|
(funcall compose)
|
|
|
|
|
agent))
|
|
|
|
|
|
|
|
|
|
|
1994-07-18 18:49:25 +00:00
|
|
|
|
;;;###autoload
|
1993-06-01 22:26:20 +00:00
|
|
|
|
(defun reporter-submit-bug-report
|
|
|
|
|
(address pkgname varlist &optional pre-hooks post-hooks salutation)
|
1999-10-25 13:50:04 +00:00
|
|
|
|
"Begin submitting a bug report via email.
|
1994-07-18 18:49:25 +00:00
|
|
|
|
|
1999-10-25 13:50:04 +00:00
|
|
|
|
ADDRESS is the email address for the package's maintainer. PKGNAME is
|
|
|
|
|
the name of the package (if you want to include version numbers,
|
|
|
|
|
you must put them into PKGNAME before calling this function).
|
2000-05-26 13:06:25 +00:00
|
|
|
|
Optional PRE-HOOKS and POST-HOOKS are passed to `reporter-dump-state'.
|
|
|
|
|
Optional SALUTATION is inserted at the top of the mail buffer,
|
|
|
|
|
and point is left after the salutation.
|
1993-06-01 22:26:20 +00:00
|
|
|
|
|
1999-10-25 13:50:04 +00:00
|
|
|
|
VARLIST is the list of variables to dump (see `reporter-dump-state'
|
|
|
|
|
for details). The optional argument PRE-HOOKS and POST-HOOKS are
|
|
|
|
|
passed to `reporter-dump-state'. Optional argument SALUTATION is text
|
|
|
|
|
to be inserted at the top of the mail buffer; in that case, point is
|
|
|
|
|
left after that text.
|
1993-06-01 22:26:20 +00:00
|
|
|
|
|
1999-10-25 13:50:04 +00:00
|
|
|
|
This function prompts for a summary if `reporter-prompt-for-summary-p'
|
|
|
|
|
is non-nil.
|
|
|
|
|
|
|
|
|
|
This function does not send a message; it uses the given information
|
2001-11-22 07:58:13 +00:00
|
|
|
|
to initialize a message, which the user can then edit and finally send
|
2001-07-16 01:50:49 +00:00
|
|
|
|
\(or decline to send). The variable `mail-user-agent' controls which
|
1999-10-25 13:50:04 +00:00
|
|
|
|
mail-sending package is used for editing and sending the message."
|
1993-06-26 11:59:44 +00:00
|
|
|
|
(let ((reporter-eval-buffer (current-buffer))
|
1994-07-18 18:49:25 +00:00
|
|
|
|
final-resting-place
|
|
|
|
|
after-sep-pos
|
1994-12-23 17:33:21 +00:00
|
|
|
|
(reporter-status-message "Formatting bug report buffer...")
|
|
|
|
|
(reporter-status-count 0)
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(problem (and reporter-prompt-for-summary-p
|
1996-07-03 01:30:24 +00:00
|
|
|
|
(read-string (if (stringp reporter-prompt-for-summary-p)
|
|
|
|
|
reporter-prompt-for-summary-p
|
|
|
|
|
"(Very) brief summary of problem: "))))
|
|
|
|
|
(agent (reporter-compose-outgoing))
|
|
|
|
|
(mailbuf (current-buffer))
|
|
|
|
|
hookvar)
|
|
|
|
|
;; do the work
|
1993-06-01 22:26:20 +00:00
|
|
|
|
(require 'sendmail)
|
2011-09-10 17:15:28 -04:00
|
|
|
|
;; Just in case the original buffer is not visible now, bring it
|
|
|
|
|
;; back somewhere
|
|
|
|
|
(display-buffer reporter-eval-buffer)
|
1996-07-03 01:30:24 +00:00
|
|
|
|
;; If mailbuf did not get made visible before, make it visible now.
|
2011-09-10 17:15:28 -04:00
|
|
|
|
(pop-to-buffer mailbuf)
|
1993-06-01 22:26:20 +00:00
|
|
|
|
(goto-char (point-min))
|
1998-04-30 06:24:03 +00:00
|
|
|
|
(mail-position-on-field "to")
|
|
|
|
|
(insert address)
|
|
|
|
|
;; insert problem summary if available
|
2013-06-12 09:08:17 -07:00
|
|
|
|
(when (and reporter-prompt-for-summary-p problem)
|
|
|
|
|
(mail-position-on-field "subject")
|
|
|
|
|
(if pkgname (insert pkgname "; "))
|
|
|
|
|
(insert problem))
|
1998-04-30 06:24:03 +00:00
|
|
|
|
;; move point to the body of the message
|
|
|
|
|
(mail-text)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(setq after-sep-pos (point))
|
|
|
|
|
(and salutation (insert "\n" salutation "\n\n"))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
(setq final-resting-place (point-marker))
|
|
|
|
|
(insert "\n\n")
|
|
|
|
|
(reporter-dump-state pkgname varlist pre-hooks post-hooks)
|
|
|
|
|
(goto-char final-resting-place))
|
|
|
|
|
(set-marker final-resting-place nil))
|
1994-07-18 18:49:25 +00:00
|
|
|
|
|
|
|
|
|
;; save initial text and set up the `no-empty-submission' hook.
|
1996-07-03 01:30:24 +00:00
|
|
|
|
;; This only works for mailers that support a pre-send hook, and
|
|
|
|
|
;; for which the paradigm has a non-nil value for the `hookvar'
|
|
|
|
|
;; key in its agent (i.e. sendmail.el's mail-send-hook).
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(skip-chars-backward " \t\n")
|
|
|
|
|
(setq reporter-initial-text (buffer-substring after-sep-pos (point))))
|
|
|
|
|
(if (setq hookvar (get agent 'hookvar))
|
2001-07-16 01:50:49 +00:00
|
|
|
|
(add-hook hookvar 'reporter-bug-hook nil t))
|
1996-07-03 01:30:24 +00:00
|
|
|
|
|
|
|
|
|
;; compose the minibuf message and display this.
|
|
|
|
|
(let* ((sendkey-whereis (where-is-internal
|
|
|
|
|
(get agent 'sendfunc) nil t))
|
|
|
|
|
(abortkey-whereis (where-is-internal
|
|
|
|
|
(get agent 'abortfunc) nil t))
|
|
|
|
|
(sendkey (if sendkey-whereis
|
|
|
|
|
(key-description sendkey-whereis)
|
|
|
|
|
"C-c C-c")) ; TBD: BOGUS hardcode
|
|
|
|
|
(abortkey (if abortkey-whereis
|
|
|
|
|
(key-description abortkey-whereis)
|
|
|
|
|
"M-x kill-buffer")) ; TBD: BOGUS hardcode
|
|
|
|
|
)
|
|
|
|
|
(message "Please enter your report. Type %s to send, %s to abort."
|
|
|
|
|
sendkey abortkey))
|
1993-06-01 22:26:20 +00:00
|
|
|
|
))
|
|
|
|
|
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(defun reporter-bug-hook ()
|
2000-05-26 13:06:25 +00:00
|
|
|
|
"Prohibit sending mail if empty bug report."
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(let ((after-sep-pos
|
|
|
|
|
(save-excursion
|
1998-05-08 22:05:42 +00:00
|
|
|
|
(rfc822-goto-eoh)
|
1994-07-18 18:49:25 +00:00
|
|
|
|
(forward-line 1)
|
|
|
|
|
(point))))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(skip-chars-backward " \t\n")
|
|
|
|
|
(if (and (= (- (point) after-sep-pos)
|
|
|
|
|
(length reporter-initial-text))
|
|
|
|
|
(string= (buffer-substring after-sep-pos (point))
|
|
|
|
|
reporter-initial-text))
|
1998-03-20 06:37:09 +00:00
|
|
|
|
(error "Empty bug report cannot be sent"))
|
1994-07-18 18:49:25 +00:00
|
|
|
|
)))
|
|
|
|
|
|
1996-07-03 01:30:24 +00:00
|
|
|
|
|
|
|
|
|
(provide 'reporter)
|
2003-09-01 15:45:59 +00:00
|
|
|
|
|
1993-06-01 22:26:20 +00:00
|
|
|
|
;;; reporter.el ends here
|