From: David Reitter <david.reitter@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Fixing report-emacs-bug
Date: Fri, 1 Jul 2005 11:31:46 +0100 [thread overview]
Message-ID: <C89C3B66-00E4-48A7-B419-D58E82938FD3@gmail.com> (raw)
In-Reply-To: <E1Do6bF-0001Uq-3j@fencepost.gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]
On 30 Jun 2005, at 22:29, Richard M. Stallman wrote:
> What is the difference between your report-emacs-bug-internally
> function and the standard report-emacs-bug function? Is it just that
> some of the code has been moved into a subroutine
> report-emacs-bug-print-debug-log? That change would be fine to
> install, and that might greatly reduce the amount of change.
Yes, that's right. The code has been refactored into the two subroutines
report-emacs-bug-print-preamble and report-emacs-bug-print-debug-log.
> However, instead of adding this feature to emacsbug.el, can you make
> sendmail.el send mail "externally" as an option? That would be much
> cleaner, wouldn't it? And it would do more good.
I thought about this, but the thing is: the external bug reporting
facility will run the mail client and cause it to start a new message
editor. If we changed sendmail.el, we would present users with the
internal editor first (for bug-reporting), then show them the same e-
mail again in their external editor. That'd be confusing.
Yet, one could augment compose-mail to start the external agent. But
I assume such changes would have knock-on effects that would be best
considered after the release. Right?
I'm attaching the (revised) fix as a patch to emacsbug.el.
[-- Attachment #2: emacsbug-patch.el --]
[-- Type: application/octet-stream, Size: 15233 bytes --]
Index: emacsbug.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/emacsbug.el,v
retrieving revision 1.64
diff -c -r1.64 emacsbug.el
*** emacsbug.el 23 Jun 2005 17:02:33 -0000 1.64
--- emacsbug.el 1 Jul 2005 10:24:10 -0000
***************
*** 1,13 ****
;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list
! ;; Copyright (C) 1985, 1994, 1997, 1998, 2000, 2001, 2002
;; Free Software Foundation, Inc.
;; Author: K. Shane Hartman
;; Maintainer: FSF
;; Keywords: maint mail
!
! ;; Not fully installed because it can work only on Internet hosts.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
--- 1,12 ----
;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list
! ;; Copyright (C) 1985, 1994, 1997, 1998, 2000, 2001, 2002, 2005
;; Free Software Foundation, Inc.
;; Author: K. Shane Hartman
;; Maintainer: FSF
;; Keywords: maint mail
!
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
***************
*** 28,40 ****
;;; Commentary:
;; `M-x report-emacs-bug' starts an email note to the Emacs maintainers
! ;; describing a problem. Here's how it's done...
! ;;; Code:
- ;; >> This should be an address which is accessible to your machine,
- ;; >> otherwise you can't use this file. It will only work on the
- ;; >> internet with this address.
(require 'sendmail)
--- 27,42 ----
;;; Commentary:
;; `M-x report-emacs-bug' starts an email note to the Emacs maintainers
! ;; describing a problem.
! ;; Works on internet hosts and with an external mail client.
!
! ;;; Internals:
! ;; report-emacs-bug-externally-p is used to decide whether to use
! ;; sendmail or to go through the external mail client.
! ;; In the latter case, the installed client (or URL handler) will
! ;; need to process a long URL in mailto: format.
(require 'sendmail)
***************
*** 48,53 ****
--- 50,61 ----
:group 'emacsbug
:type 'string)
+ (defcustom report-emacs-bug-cc-list nil
+ "List of e-mail addresses to cc when reporting bugs."
+ :group 'emacsbug
+ :type '(repeat (string :tag "Address"))
+ )
+
(defcustom report-emacs-bug-pretest-address "emacs-pretest-bug@gnu.org"
"*Address of mailing list for GNU Emacs pretest bugs."
:group 'emacsbug
***************
*** 69,92 ****
:group 'emacsbug
:type 'boolean)
! ;;;###autoload
! (defun report-emacs-bug (topic &optional recent-keys)
! "Report a bug in GNU Emacs.
! Prompts for bug subject. Leaves you in a mail buffer."
! ;; This strange form ensures that (recent-keys) is the value before
! ;; the bug subject string is read.
! (interactive (reverse (list (recent-keys) (read-string "Bug Subject: "))))
! ;; If there are four numbers in emacs-version, this is a pretest
! ;; version.
! (let ((pretest-p (string-match "\\..*\\..*\\." emacs-version))
! (from-buffer (current-buffer))
user-point prompt-beg-point message-end-point)
(setq message-end-point
(with-current-buffer (get-buffer-create "*Messages*")
(point-max-marker)))
! (compose-mail (if pretest-p
! report-emacs-bug-pretest-address
! report-emacs-bug-address)
topic)
;; The rest of this does not execute
;; if the user was asked to confirm and said no.
--- 77,258 ----
:group 'emacsbug
:type 'boolean)
! (defun report-emacs-bug-externally-p ()
! "Returns non-nil if an external mail client is to be used in
! order to report bugs. The decision is based on the browse-url
! function used, because we leave it to the underlying system or
! HTML browser to bring up the appropriate mail client.
! On systems where sendmail is inoperable by default, this
! function usually returns non-nil."
!
! (member browse-url-browser-function
! '(browse-url-mozilla
! browse-url-netscape
! browse-url-galeon
! browse-url-epiphany
! browse-url-netscape
! browse-url-kde
! browse-url-default-windows-browser
! browse-url-default-macosx-browser
! browse-url-gnome-moz
! )
! )
! )
!
! (defun report-emacs-bug-print-preamble (address)
! (unless report-emacs-bug-no-explanations
! ;; Insert warnings for novice users.
! (insert "This bug report will be sent to the Free Software Foundation,\n")
! (let ((pos (point)))
! (insert "not to your local site managers!")
! (put-text-property pos (point) 'face 'highlight))
! (insert "\nPlease write in ")
! (let ((pos (point)))
! (insert "English")
! (put-text-property pos (point) 'face 'highlight))
! (insert " if possible, because the Emacs maintainers
! usually do not have translators to read other languages for them.\n\n")
! (insert (format "Your bug report will be posted to the %s mailing list"
! address))
! (insert " and possibly to the gnu.emacs.bug news group.\n\n")
! )
!
! (insert "Please describe exactly what actions triggered the bug\n"
! "and the precise symptoms of the bug:")
! )
!
! (defun report-emacs-bug-print-debug-log (from-buffer message-end-point &optional recent-keys)
! (insert "In " (emacs-version) "\n")
! (if (fboundp 'x-server-vendor)
! (condition-case nil
! (insert "Display server distributor `" (x-server-vendor) "', version "
! (mapconcat 'number-to-string (x-server-version) ".") "\n")
! (error t)))
! (if (and system-configuration-options
! (not (equal system-configuration-options "")))
! (insert "configured using `configure "
! system-configuration-options "'\n\n"))
! (insert "Important settings:\n")
! (mapcar
! '(lambda (var)
! (insert (format " value of $%s: %s\n" var (getenv var))))
! '("LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES"
! "LC_MONETARY" "LC_NUMERIC" "LC_TIME" "LANG"))
! (insert (format " locale-coding-system: %s\n" locale-coding-system))
! (insert (format " default-enable-multibyte-characters: %s\n"
! default-enable-multibyte-characters))
! (insert "\n")
! (insert (format "Major mode: %s\n"
! (buffer-local-value 'mode-name from-buffer)))
! (insert "\n")
! (insert "Minor modes in effect:\n")
! (dolist (mode minor-mode-list)
! (and (boundp mode) (buffer-local-value mode from-buffer)
! (insert (format " %s: %s\n" mode
! (buffer-local-value mode from-buffer)))))
! (insert "\n")
! (insert "Recent input:\n")
! (let ((before-keys (point)))
! (insert (mapconcat (lambda (key)
! (if (or (integerp key)
! (symbolp key)
! (listp key))
! (single-key-description key)
! (prin1-to-string key nil)))
! (or recent-keys (recent-keys))
! " "))
! (save-restriction
! (narrow-to-region before-keys (point))
! (goto-char before-keys)
! (while (progn (move-to-column 50) (not (eobp)))
! (search-forward " " nil t)
! (insert "\n"))))
! (let ((message-buf (get-buffer "*Messages*")))
! (if message-buf
! (let (beg-pos
! (end-pos message-end-point))
! (with-current-buffer message-buf
! (goto-char end-pos)
! (forward-line -10)
! (setq beg-pos (point)))
! (insert "\n\nRecent messages:\n")
! (insert-buffer-substring message-buf beg-pos end-pos))
! )
! )
! )
!
! ;; Copied from w3m-url-encode-string (w3m.el)
! (defun url-encode-string (string &optional coding)
! "Encode STRING by url-encoding.
! Optional CODING is used for encoding coding-system."
! (apply (function concat)
! (mapcar
! (lambda (ch)
! (cond
! ((eq ch ?\n) ; newline
! "%0D%0A")
! ((string-match "[-a-zA-Z0-9_:/.]" (char-to-string ch))
! (char-to-string ch)) ; printable
! ((char-equal ch ?\x20) ; space
! "%20")
! (t
! (format "%%%02x" ch)))) ; escape
! ;; Coerce a string to a list of chars.
! (append (encode-coding-string (or string "")
! (or coding
! file-name-coding-system))
! nil))))
!
! (defun report-emacs-bug-externally ( topic recent-keys address)
! "Report a bug using the default mail agent. "
!
! (let ( (from-buffer (current-buffer))
! user-point prompt-beg-point message-end-point)
!
! (setq message-end-point
! (with-current-buffer (get-buffer-create "*Messages*")
! (point-max-marker)))
!
! (with-temp-buffer
!
!
! (setq prompt-beg-point (point))
! (report-emacs-bug-print-preamble address)
!
! (setq report-emacs-bug-text-prompt
! (buffer-substring prompt-beg-point (point)))
!
! (insert "\n\n\n\n\n\n\n\n\n(insert your text here)\n\n\n\n\n\n\n\n\n")
!
! (report-emacs-bug-print-debug-log from-buffer message-end-point recent-keys)
!
!
! ;; open in mail program
! ;; from here on, we have no control over what's going to happen.
!
! (browse-url (format "mailto:%s\?&subject=%s&body=%s%s"
! address
! (if topic (url-encode-string topic) "")
! (url-encode-string (buffer-string))
! (apply 'concat (mapcar
! (lambda (a) (concat "&cc=" a))
! report-emacs-bug-cc-list))
!
! )
! )
! )
! )
! )
!
! (defun report-emacs-bug-internally (topic recent-keys address)
! "Report a bug using the internal mail system via ``compose-mail''"
!
! (let ((from-buffer (current-buffer))
user-point prompt-beg-point message-end-point)
(setq message-end-point
(with-current-buffer (get-buffer-create "*Messages*")
(point-max-marker)))
! (compose-mail address
topic)
;; The rest of this does not execute
;; if the user was asked to confirm and said no.
***************
*** 98,125 ****
(insert signature)
(backward-char (length signature)))
(setq prompt-beg-point (point))
- (unless report-emacs-bug-no-explanations
- ;; Insert warnings for novice users.
- (insert "This bug report will be sent to the Free Software Foundation,\n")
- (let ((pos (point)))
- (insert "not to your local site managers!")
- (put-text-property pos (point) 'face 'highlight))
- (insert "\nPlease write in ")
- (let ((pos (point)))
- (insert "English")
- (put-text-property pos (point) 'face 'highlight))
- (insert " if possible, because the Emacs maintainers
- usually do not have translators to read other languages for them.\n\n")
- (insert (format "Your bug report will be posted to the %s mailing list"
- (if pretest-p
- report-emacs-bug-pretest-address
- report-emacs-bug-address)))
- (if pretest-p
- (insert ".\n\n")
- (insert ",\nand to the gnu.emacs.bug news group.\n\n")))
! (insert "Please describe exactly what actions triggered the bug\n"
! "and the precise symptoms of the bug:")
(setq report-emacs-bug-text-prompt
(buffer-substring prompt-beg-point (point)))
--- 264,272 ----
(insert signature)
(backward-char (length signature)))
(setq prompt-beg-point (point))
! (report-emacs-bug-print-preamble address)
!
(setq report-emacs-bug-text-prompt
(buffer-substring prompt-beg-point (point)))
***************
*** 127,187 ****
(setq user-point (point))
(insert "\n\n\n")
! (insert "In " (emacs-version) "\n")
! (if (fboundp 'x-server-vendor)
! (condition-case nil
! (insert "X server distributor `" (x-server-vendor) "', version "
! (mapconcat 'number-to-string (x-server-version) ".") "\n")
! (error t)))
! (if (and system-configuration-options
! (not (equal system-configuration-options "")))
! (insert "configured using `configure "
! system-configuration-options "'\n\n"))
! (insert "Important settings:\n")
! (mapcar
! '(lambda (var)
! (insert (format " value of $%s: %s\n" var (getenv var))))
! '("LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES"
! "LC_MONETARY" "LC_NUMERIC" "LC_TIME" "LANG"))
! (insert (format " locale-coding-system: %s\n" locale-coding-system))
! (insert (format " default-enable-multibyte-characters: %s\n"
! default-enable-multibyte-characters))
! (insert "\n")
! (insert (format "Major mode: %s\n"
! (buffer-local-value 'mode-name from-buffer)))
! (insert "\n")
! (insert "Minor modes in effect:\n")
! (dolist (mode minor-mode-list)
! (and (boundp mode) (buffer-local-value mode from-buffer)
! (insert (format " %s: %s\n" mode
! (buffer-local-value mode from-buffer)))))
! (insert "\n")
! (insert "Recent input:\n")
! (let ((before-keys (point)))
! (insert (mapconcat (lambda (key)
! (if (or (integerp key)
! (symbolp key)
! (listp key))
! (single-key-description key)
! (prin1-to-string key nil)))
! (or recent-keys (recent-keys))
! " "))
! (save-restriction
! (narrow-to-region before-keys (point))
! (goto-char before-keys)
! (while (progn (move-to-column 50) (not (eobp)))
! (search-forward " " nil t)
! (insert "\n"))))
! (let ((message-buf (get-buffer "*Messages*")))
! (if message-buf
! (let (beg-pos
! (end-pos message-end-point))
! (with-current-buffer message-buf
! (goto-char end-pos)
! (forward-line -10)
! (setq beg-pos (point)))
! (insert "\n\nRecent messages:\n")
! (insert-buffer-substring message-buf beg-pos end-pos))))
;; This is so the user has to type something
;; in order to send easily.
(use-local-map (nconc (make-sparse-keymap) (current-local-map)))
--- 274,281 ----
(setq user-point (point))
(insert "\n\n\n")
! (report-emacs-bug-print-debug-log from-buffer message-end-point recent-keys)
!
;; This is so the user has to type something
;; in order to send easily.
(use-local-map (nconc (make-sparse-keymap) (current-local-map)))
***************
*** 209,214 ****
--- 303,337 ----
(setq report-emacs-bug-orig-text (buffer-substring (point-min) (point))))
(goto-char user-point)))
+
+
+ ;;;###autoload
+ (defun report-emacs-bug (topic &optional recent-keys)
+ "Report a bug in GNU Emacs.
+ Prompts for bug subject. Either leaves you in a mail buffer
+ or brings up an external mail client, depending on your
+ system settings, i.e. your chosen URL browser function that
+ should handle sending e-mail."
+
+ ;; This strange form ensures that (recent-keys) is the value before
+ ;; the bug subject string is read.
+ (interactive (reverse (list (recent-keys) (read-string "Bug Subject: "))))
+
+ (let ((address
+ ;; If there are four numbers in emacs-version, this is a pretest
+ ;; version.
+ (if (string-match "\\..*\\..*\\." emacs-version)
+ report-emacs-bug-pretest-address
+ report-emacs-bug-address)
+ )
+ )
+ (if (report-emacs-bug-externally-p)
+ (report-emacs-bug-externally topic recent-keys address)
+ (report-emacs-bug-internally topic recent-keys address)
+ )
+ )
+ )
+
(defun report-emacs-bug-info ()
"Go to the Info node on reporting Emacs bugs."
(interactive)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2005-07-01 10:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-30 10:15 Fixing report-emacs-bug David Reitter
2005-06-30 19:37 ` Stefan Monnier
2005-07-03 19:14 ` David Reitter
2005-07-04 6:16 ` Richard M. Stallman
2005-07-04 10:07 ` David Reitter
2005-07-04 10:24 ` Jan D.
2005-07-04 16:48 ` Richard M. Stallman
2005-07-04 15:16 ` Joakim Verona
2005-07-04 16:03 ` David Reitter
2005-07-04 17:37 ` Stefan Monnier
2005-07-04 17:46 ` David Reitter
2005-07-04 18:35 ` Stefan Monnier
2005-07-04 18:49 ` Lennart Borgman
2005-07-04 19:34 ` Jason Rumney
2005-07-04 19:52 ` David Reitter
2005-07-04 22:02 ` Stefan Monnier
2005-07-05 2:38 ` Miles Bader
2005-07-05 4:33 ` Stefan Monnier
[not found] ` <E1Do6bF-0001Uq-3j@fencepost.gnu.org>
2005-07-01 10:31 ` David Reitter [this message]
2005-07-01 22:45 ` Richard M. Stallman
2005-07-03 19:21 ` David Reitter
2005-07-03 20:52 ` Lennart Borgman
2005-07-04 6:17 ` Richard M. Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C89C3B66-00E4-48A7-B419-D58E82938FD3@gmail.com \
--to=david.reitter@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.