X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/c6d354e76e05aa2b2031f6b560a2e5cac7bd2f9d..f39a98f4450e7291fd30b71b52228880f5619133:/lisp/mail/reporter.el diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el index ce245d76b8..6e609a1f36 100644 --- a/lisp/mail/reporter.el +++ b/lisp/mail/reporter.el @@ -3,10 +3,8 @@ ;; Copyright (C) 1993,1994,1995,1996,1997,1998 Free Software Foundation, Inc. ;; Author: 1993-1998 Barry A. Warsaw -;; Maintainer: tools-help@python.org +;; Maintainer: FSF ;; Created: 19-Apr-1993 -;; Version: 3.34 -;; Last Modified: 1998/03/19 17:21:16 ;; Keywords: maint mail tools ;; This file is part of GNU Emacs. @@ -64,15 +62,6 @@ ;; ;; ... ;; 'mypkg-variable-last))) -;; Reporter Users -;; ============== -;; Packages that currently use reporter are: CC Mode, supercite, elp, -;; tcl, ediff, crypt++ (crypt), dired-x, rmailgen, mode-line, vm, -;; mh-e, edebug, archie, viper, w3-mode, framepop, hl319, hilit19, -;; pgp, eos, hm--html, efs, webster19. -;; -;; If you know of others, please email me! - ;;; Code: @@ -86,7 +75,7 @@ brief summary of the problem, and puts this summary on the Subject: line. If this variable is a string, that string is used as the prompt string. -Default behavior is to not prompt (i.e. nil). If you want reporter to +Default behavior is to not prompt (i.e. nil). If you want reporter to prompt, you should `let' bind this variable before calling `reporter-submit-bug-report'. Note that this variable is not buffer-local so you should never just `setq' it.") @@ -114,9 +103,6 @@ This is necessary to properly support the printing of buffer-local variables. Current buffer will always be the mail buffer being composed.") -(defconst reporter-version "3.34" - "Reporter version number.") - (defvar reporter-initial-text nil "The automatically created initial text of a bug report.") (make-variable-buffer-local 'reporter-initial-text) @@ -128,7 +114,7 @@ composed.") (defvar reporter-status-count nil) (defun reporter-update-status () - ;; periodically output a status message + "Periodically output a status message." (if (zerop (% reporter-status-count 10)) (progn (message reporter-status-message) @@ -138,7 +124,7 @@ composed.") ;; dumping/pretty printing of values (defun reporter-beautify-list (maxwidth compact-p) - ;; pretty print a list + "Pretty print a list." (reporter-update-status) (let ((move t) linebreak indent-enclosing-p indent-p here) @@ -176,14 +162,14 @@ composed.") (error indent-enclosing-p)))) (defun reporter-lisp-indent (indent-point state) - ;; a better lisp indentation style for bug reporting + "A better lisp indentation style for bug reporting." (save-excursion (goto-char (1+ (nth 1 state))) (current-column))) (defun reporter-dump-variable (varsym mailbuf) - ;; Pretty-print the value of the variable in symbol VARSYM. MAILBUF - ;; is the mail buffer being composed + "Pretty-print the value of the variable in symbol VARSYM. +MAILBUF is the mail buffer being composed." (reporter-update-status) (condition-case nil (let ((val (save-excursion @@ -222,29 +208,29 @@ composed.") (error "")))) (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. + "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." (let ((buffer (current-buffer))) (set-buffer buffer) (insert "Emacs : " (emacs-version) "\n") @@ -285,30 +271,12 @@ composed.") (run-hooks 'post-hooks) )) - -(defun reporter-calculate-separator () - ;; returns the string regexp matching the mail separator - (save-excursion - (re-search-forward - (concat - "^\\(" ;beginning of line - (mapconcat - 'identity - (list "[\t ]*" ;simple SMTP form - "-+" ;mh-e form - (regexp-quote - mail-header-separator)) ;sendmail.el form - "\\|") ;or them together - "\\)$") ;end of line - nil - 'move) ;search for and move - (buffer-substring (match-beginning 0) (match-end 0)))) - (defun reporter-compose-outgoing () - ;; compose the outgoing mail buffer, and return the selected - ;; paradigm, with the current-buffer tacked onto the beginning of - ;; the list. + "Compose the outgoing mail buffer. + +Return the selected paradigm, with the current buffer tacked onto the +beginning of the list." (let* ((agent mail-user-agent) (compose (get mail-user-agent 'composefunc))) ;; Sanity check. If this fails then we'll try to use the SENDMAIL @@ -330,19 +298,28 @@ composed.") ;;;###autoload (defun reporter-submit-bug-report (address pkgname varlist &optional pre-hooks post-hooks salutation) - ;; Submit a bug report via mail. - - ;; ADDRESS is the email address for the package's maintainer. PKGNAME is - ;; the name of the mode (you must explicitly concat any version numbers). - ;; VARLIST is the list of variables to dump (see `reporter-dump-state' - ;; for details). 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. - - ;; This function will prompt for a summary if - ;; reporter-prompt-for-summary-p is non-nil. - - ;; The mailer used is described in by the variable `mail-user-agent'. +"Begin submitting a bug report via email. + +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). +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. + +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. + +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 +to initialize a message, which the user can then edit and finally send +\(or decline to send). The variable `mail-user-agent' controls which +mail-sending package is used for editing and sending the message." (let ((reporter-eval-buffer (current-buffer)) final-resting-place after-sep-pos @@ -364,29 +341,25 @@ composed.") ;; back somewhere (and pop-up-windows (display-buffer reporter-eval-buffer))) (goto-char (point-min)) - ;; different mailers use different separators, some may not even - ;; use mail-header-separator, but sendmail.el stuff must have this - ;; variable bound. - (let ((mail-header-separator (reporter-calculate-separator))) - (mail-position-on-field "to") - (insert address) - ;; insert problem summary if available - (if (and reporter-prompt-for-summary-p problem pkgname) - (progn - (mail-position-on-field "subject") - (insert pkgname "; " problem))) - ;; 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))) + (mail-position-on-field "to") + (insert address) + ;; insert problem summary if available + (if (and reporter-prompt-for-summary-p problem pkgname) + (progn + (mail-position-on-field "subject") + (insert pkgname "; " problem))) + ;; 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)) ;; save initial text and set up the `no-empty-submission' hook. ;; This only works for mailers that support a pre-send hook, and @@ -397,9 +370,7 @@ composed.") (skip-chars-backward " \t\n") (setq reporter-initial-text (buffer-substring after-sep-pos (point)))) (if (setq hookvar (get agent 'hookvar)) - (progn - (make-variable-buffer-local hookvar) - (add-hook hookvar 'reporter-bug-hook))) + (add-hook hookvar 'reporter-bug-hook nil t)) ;; compose the minibuf message and display this. (let* ((sendkey-whereis (where-is-internal @@ -418,11 +389,10 @@ composed.") )) (defun reporter-bug-hook () - ;; prohibit sending mail if empty bug report + "Prohibit sending mail if empty bug report." (let ((after-sep-pos (save-excursion - (beginning-of-buffer) - (re-search-forward (reporter-calculate-separator) (point-max) 'move) + (rfc822-goto-eoh) (forward-line 1) (point)))) (save-excursion @@ -437,4 +407,6 @@ composed.") (provide 'reporter) + +;;; arch-tag: 33612ff4-fbbc-4be2-b183-560ce9e0199b ;;; reporter.el ends here