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: Fixing report-emacs-bug Date: Thu, 30 Jun 2005 11:15:09 +0100 Message-ID: <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="===============0436786754==" X-Trace: sea.gmane.org 1120127870 3195 80.91.229.2 (30 Jun 2005 10:37:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 30 Jun 2005 10:37:50 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 30 12:37:39 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DnwPo-0007kk-GS for ged-emacs-devel@m.gmane.org; Thu, 30 Jun 2005 12:37:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DnwXh-0000Rg-P0 for ged-emacs-devel@m.gmane.org; Thu, 30 Jun 2005 06:45:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DnwSS-0006zb-UH for emacs-devel@gnu.org; Thu, 30 Jun 2005 06:39:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DnwSQ-0006yz-Gk for emacs-devel@gnu.org; Thu, 30 Jun 2005 06:39:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DnwQ1-0006JK-3U for emacs-devel@gnu.org; Thu, 30 Jun 2005 06:37:17 -0400 Original-Received: from [64.233.184.195] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DnwBW-0000V9-8x for emacs-devel@gnu.org; Thu, 30 Jun 2005 06:22:18 -0400 Original-Received: by wproxy.gmail.com with SMTP id i2so70099wra for ; Thu, 30 Jun 2005 03:17:16 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:to:message-id:content-type:from:subject:date:x-mailer; b=B4LcNT0lXdPkxjW9/cgrlJs8DOvMFv9yC4odVJzTLPyLqgCP0lPpugIlbM0V+tEXCo8LKYWElvgMvpKytbW78quPIXc4w5Ecm71vBakiKo8SVoqccK7H4nuKJHV7ES5FDwkjH3LvAtL+05m0faWpCxnSrTu2g0wK7EZoLxbp9Bs= Original-Received: by 10.54.11.58 with SMTP id 58mr298758wrk; Thu, 30 Jun 2005 03:17:16 -0700 (PDT) Original-Received: from ?129.215.174.81? ([129.215.174.81]) by mx.gmail.com with ESMTP id 35sm590299wra.2005.06.30.03.15.12; Thu, 30 Jun 2005 03:17:16 -0700 (PDT) Original-To: emacs-devel@gnu.org 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:39949 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39949 --===============0436786754== Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-5-85389490; protocol="application/pkcs7-signature" --Apple-Mail-5-85389490 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed As described a while ago, report-emacs-bug doesn't work on Mac OS X (unless the user chooses to activate postfix). It swallows bug reports without indicating an error. In general report-emacs-bug usually depends on working mail system being set up, and despite an e-mail being sent off, the function doesn't respect the user's system-wide choice of an e-mail application. The code below is adapted from what we use in Aquamacs Emacs. It extends the current functionality of emacsbug.el by defining two bug reporting methods: internal and external. report-emacs-bug-externally-p is used to decide about the method, and as you can see, the setting depends on the value of browse-url- browser-function right now. It might be good to think of a better check here. To prepare an external e-mail, we use a mailto: URL, which is handled by the underlying system / window-manager or the default browser. Last time I checked, it worked fine on a KDE installation (GNU/Linux, RH8) with Mozilla. Foreseeable problems are caused by older browser versions that can't handle long URLs. But given that reporting doesn't work at all (and fails silently) on OS X (what's the status in the Windows port?), I found this to be the lesser evil in Aquamacs. If there is sufficient interest and approval, I'd be happy to convert the below code into a patch for emacsbug.el. ;; aquamacs-bug.el (modified for CVS Emacs) ;; Author: adapted from emacsbug.el by K. Shane Hartman ;; Maintainer: David Reitter ;; Keywords: mac bug report ;; Last change: $Id: aquamacs-bug.el,v 1.6 2005/06/27 11:43:03 davidswelt Exp $ ;; This file is part of Aquamacs Emacs ;; http://www.aquamacs.org/ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; 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. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;; Copyright (C) 1985, 1994, 1997, 1998, 2000, 2001, 2002 ;; Free Software Foundation, Inc. ;; Copyright (C) 2005, David Reitter (require 'emacsbug) (setq report-emacs-bug-address "bug-gnu-emacs@gnu.org") (setq report-emacs-bug-pretest-address "emacs-pretest-bug@gnu.org") (defvar report-emacs-bug-cc-list nil "List of e-mail addresses to cc when reporting bugs.") (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 the HTML to bring up the appropriate mail client." (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 (&optional recent-keys) (insert "In " (emacs-version) "\n") (if (fboundp 'x-server-vendor) (condition-case nil (insert "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)) ) ) ) (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 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. (rfc822-goto-eoh) (forward-line 1) (let ((signature (buffer-substring (point) (point-max)))) (delete-region (point) (point-max)) (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))) (insert "\n\n") (setq user-point (point)) (insert "\n\n\n") (report-emacs-bug-print-debug-log 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))) (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info) (unless report-emacs-bug-no-explanations (with-output-to-temp-buffer "*Bug Help*" (if (eq mail-user-agent 'sendmail-user-agent) (princ (substitute-command-keys "Type \\[mail-send-and-exit] to send the bug report.\n"))) (princ (substitute-command-keys "Type \\[kill-buffer] RET to cancel (don't send it).\n")) (terpri) (princ (substitute-command-keys "Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section about when and how to write a bug report, and what information to supply so that the bug can be fixed. Type SPC to scroll through this section and its subsections.")))) ;; Make it less likely people will send empty messages. (make-local-variable 'mail-send-hook) (add-hook 'mail-send-hook 'report-emacs-bug-hook) (save-excursion (goto-char (point-max)) (skip-chars-backward " \t\n") (make-local-variable 'report-emacs-bug-orig-text) (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point)))) (goto-char user-point))) (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." ;; 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) ) ) ) --Apple-Mail-5-85389490 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGOzCCAvQw ggJdoAMCAQICAw3xWjANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwMjAxMjM0NT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hkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0w NTA2MzAxMDE1MTBaMCMGCSqGSIb3DQEJBDEWBBRJy6TfgfF8LGLXpc54Mc8e6sP04TB4BgkrBgEE AYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5 KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIDDfFa MHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1 bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3Vp bmcgQ0ECAw3xWjANBgkqhkiG9w0BAQEFAASCAQC30Iyid6q7i5Ao5oPWCSkoMJq/FJaj+uV9f09O 6dLIwMMb9qT8uANdgXUeyJQEbjXhQqEHoeQCIbLn0+wj+nZt72vj2YSSPO5TdChmHBrTgaMkNEwp ZpkMQsZ31zowmuxafGAF5vgwnFkJTfm1bf+0Ovs1hWuf0oR3F2ZlAjb/VdBAX72laR6kHLHCtX7A dbf/ax3Go2cVhFSnZdw1pLy6xMtquWMKpvZZANhg9gRjYdSZTg3+fKaPx7xQRrsgRsgL086phpm2 yP8mEEGbSa+df8V5f50kt2LhH5hoYCj2u28Pd+e71laqrboHMHutp4b/VLgzKcUgnrQ1NNcIQbs8 AAAAAAAA --Apple-Mail-5-85389490-- --===============0436786754== 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 --===============0436786754==--