From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Reitter Newsgroups: gmane.emacs.devel Subject: Re: Fixing report-emacs-bug Date: Fri, 1 Jul 2005 11:31:46 +0100 Message-ID: References: <66D10997-3675-4D74-9DD3-340D2DD69871@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v730) Content-Type: multipart/mixed; boundary=Apple-Mail-20-172786173 X-Trace: sea.gmane.org 1120214707 2970 80.91.229.2 (1 Jul 2005 10:45:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 1 Jul 2005 10:45:07 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 01 12:45:06 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DoJ0S-0001ra-Dt for ged-emacs-devel@m.gmane.org; Fri, 01 Jul 2005 12:44:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DoJ8t-0003V7-65 for ged-emacs-devel@m.gmane.org; Fri, 01 Jul 2005 06:53:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DoIt0-0007q6-Lt for emacs-devel@gnu.org; Fri, 01 Jul 2005 06:36:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DoIsk-0007kp-FO for emacs-devel@gnu.org; Fri, 01 Jul 2005 06:36:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DoIsj-0007Xu-S5 for emacs-devel@gnu.org; Fri, 01 Jul 2005 06:36:25 -0400 Original-Received: from [64.233.184.206] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DoItO-0001fm-BP for emacs-devel@gnu.org; Fri, 01 Jul 2005 06:37:06 -0400 Original-Received: by wproxy.gmail.com with SMTP id i2so310921wra for ; Fri, 01 Jul 2005 03:31:50 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:from:subject:date:to:x-mailer; b=tV4Je3LpyfM5TKCYW4LDm7WqBLXHAAmGoSf8Tc0ZNv3NQ9WUo4syHXY5c10MnTp9o6l2EfSoPV7l4IldK/Q/ILwP0BgsZlU2PK6HzoxTDLJUpLXjQVMX7RvvlWK4DnHt0on8E0gdxwnDRPmSc9CznhWB5iJtrFM1UapvMU7el0o= Original-Received: by 10.54.45.7 with SMTP id s7mr1361531wrs; Fri, 01 Jul 2005 03:31:50 -0700 (PDT) Original-Received: from ?129.215.174.81? ([129.215.174.81]) by mx.gmail.com with ESMTP id g3sm1127580wra.2005.07.01.03.31.49; Fri, 01 Jul 2005 03:31:50 -0700 (PDT) In-Reply-To: Original-To: Richard Stallman , Stefan Monnier X-Mailer: Apple Mail (2.730) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:40024 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:40024 --Apple-Mail-20-172786173 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed 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. --Apple-Mail-20-172786173 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="emacsbug-patch.el" Content-Disposition: attachment; filename=emacsbug-patch.el 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) --Apple-Mail-20-172786173 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --Apple-Mail-20-172786173--