]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/emacsbug.el
(report-emacs-bug): Make a better guess at envelope-from
[gnu-emacs] / lisp / mail / emacsbug.el
index c35809ef6484d7d56230841dc9e95ac5afadbf3d..4cfd3e2051e3eafb04f2ee30a36ac04ff45c6ff9 100644 (file)
@@ -1,10 +1,10 @@
 ;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list
 
-;; Copyright (C) 1985, 1994, 1997-1998, 2000-2013 Free Software
+;; Copyright (C) 1985, 1994, 1997-1998, 2000-2014 Free Software
 ;; Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: maint mail
 ;; Package: emacs
 
@@ -142,13 +142,18 @@ This requires either the OS X \"open\" command, or the freedesktop
                           (concat "mailto:" to)))
        (error "Subject, To or body not found")))))
 
+;; It's the default mail mode, so it seems OK to use its features.
+(autoload 'message-bogus-recipient-p "message")
+(autoload 'message-make-address "message")
+(defvar message-send-mail-function)
+(defvar message-sendmail-envelope-from)
+
 ;;;###autoload
-(defun report-emacs-bug (topic &optional recent-keys)
+(defun report-emacs-bug (topic &optional unused)
   "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: "))))
+  (declare (advertised-calling-convention (topic) "24.5"))
+  (interactive "sBug Subject: ")
   ;; The syntax `version;' is preferred to `[version]' because the
   ;; latter could be mistakenly stripped by mailing software.
   (if (eq system-type 'ms-dos)
@@ -160,7 +165,7 @@ Prompts for bug subject.  Leaves you in a mail buffer."
                             (report-emacs-bug-can-use-osx-open)))
         user-point message-end-point)
     (setq message-end-point
-         (with-current-buffer (get-buffer-create "*Messages*")
+         (with-current-buffer (messages-buffer)
            (point-max-marker)))
     (compose-mail report-emacs-bug-address topic)
     ;; The rest of this does not execute if the user was asked to
@@ -170,7 +175,12 @@ Prompts for bug subject.  Leaves you in a mail buffer."
       ;; that report-emacs-bug-orig-text remains valid.  (Bug#5178)
       (message-sort-headers)
       ;; Stop message-mode stealing the properties we will add.
-      (set (make-local-variable 'message-strip-special-text-properties) nil))
+      (set (make-local-variable 'message-strip-special-text-properties) nil)
+      ;; Make sure we default to the From: address as envelope when sending
+      ;; through sendmail.
+      (when (and (not message-sendmail-envelope-from)
+                (message-bogus-recipient-p (message-make-address)))
+       (set (make-local-variable 'message-sendmail-envelope-from) 'header)))
     (rfc822-goto-eoh)
     (forward-line 1)
     ;; Move the mail signature to the proper place.
@@ -230,8 +240,8 @@ usually do not have translators for other languages.\n\n")))
       (insert (propertize "\n" 'display txt)))
 
     (insert "\n\nIn " (emacs-version) "\n")
-    (if (stringp emacs-bzr-version)
-       (insert "Bzr revision: " emacs-bzr-version "\n"))
+    (if (stringp emacs-repository-version)
+       (insert "Repository revision: " emacs-repository-version "\n"))
     (if (fboundp 'x-server-vendor)
        (condition-case nil
             ;; This is used not only for X11 but also W32 and others.
@@ -260,8 +270,11 @@ usually do not have translators for other languages.\n\n")))
        "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES"
        "LC_MONETARY" "LC_NUMERIC" "LC_TIME" "LANG" "XMODIFIERS"))
     (insert (format "  locale-coding-system: %s\n" locale-coding-system))
-    (insert (format "  default enable-multibyte-characters: %s\n"
-                   (default-value 'enable-multibyte-characters)))
+    ;; Only ~ 0.2% of people from a sample of 3200 changed this from
+    ;; the default, t.
+    (or (default-value 'enable-multibyte-characters)
+       (insert (format "  default enable-multibyte-characters: %s\n"
+                       (default-value 'enable-multibyte-characters))))
     (insert "\n")
     (insert (format "Major mode: %s\n"
                    (format-mode-line
@@ -273,23 +286,6 @@ usually do not have translators for other languages.\n\n")))
       (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
@@ -298,7 +294,7 @@ usually do not have translators for other languages.\n\n")))
              (goto-char end-pos)
              (forward-line -10)
              (setq beg-pos (point)))
-           (insert "\n\nRecent messages:\n")
+           (insert "\nRecent messages:\n")
            (insert-buffer-substring message-buf beg-pos end-pos))))
     ;; After Recent messages, to avoid the messages produced by
     ;; list-load-path-shadows.
@@ -319,11 +315,15 @@ usually do not have translators for other languages.\n\n")))
                 shadows)))
     (insert (format "\nFeatures:\n%s\n" features))
     (fill-region (line-beginning-position 0) (point))
+
+    (insert (format "\nMemory information:\n"))
+    (pp (garbage-collect) (current-buffer))
+    
     ;; 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" 'info-emacs-bug)
     (if can-insert-mail
-       (define-key (current-local-map) "\C-cm"
+       (define-key (current-local-map) "\C-c\M-i"
          'report-emacs-bug-insert-to-mailer))
     (setq report-emacs-bug-send-command (get mail-user-agent 'sendfunc)
          report-emacs-bug-send-hook (get mail-user-agent 'hookvar))
@@ -360,10 +360,6 @@ usually do not have translators for other languages.\n\n")))
 
 (define-obsolete-function-alias 'report-emacs-bug-info 'info-emacs-bug "24.3")
 
-;; It's the default mail mode, so it seems OK to use its features.
-(autoload 'message-bogus-recipient-p "message")
-(defvar message-send-mail-function)
-
 (defun report-emacs-bug-hook ()
   "Do some checking before sending a bug report."
   (save-excursion
@@ -396,7 +392,7 @@ and send the mail again%s."
                             (format " using \\[%s]"
                                     report-emacs-bug-send-command)
                           "")))))
-      (error "M-x report-emacs-bug was cancelled, please read *Bug Help* buffer"))
+      (error "M-x report-emacs-bug was canceled, please read *Bug Help* buffer"))
     ;; Query the user for the SMTP method, so that we can skip
     ;; questions about From header validity if the user is going to
     ;; use mailclient, anyway.