emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107236: Prompt in a more logical fas


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107236: Prompt in a more logical fashion when sending bug reports
Date: Fri, 10 Feb 2012 19:16:19 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107236
committer: Lars Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Fri 2012-02-10 19:16:19 +0100
message:
  Prompt in a more logical fashion when sending bug reports
  
  * gnus/message.el (message-default-send-mail-function): Made into own
  function for reuse by emacsbug.el.
  
  * mail/emacsbug.el (report-emacs-bug-hook): Query the user first
  about SMTP before checking the From header.
  
  * mail/sendmail.el (sendmail-query-user-about-smtp): Refacored out
  into own function for reuse by emacsbug.el.
modified:
  lisp/ChangeLog
  lisp/gnus/ChangeLog
  lisp/gnus/message.el
  lisp/mail/emacsbug.el
  lisp/mail/sendmail.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-02-10 15:59:29 +0000
+++ b/lisp/ChangeLog    2012-02-10 18:16:19 +0000
@@ -1,3 +1,11 @@
+2012-02-10  Lars Ingebrigtsen  <address@hidden>
+
+       * mail/emacsbug.el (report-emacs-bug-hook): Query the user first
+       about SMTP before checking the From header.
+
+       * mail/sendmail.el (sendmail-query-user-about-smtp): Refacored out
+       into own function for reuse by emacsbug.el.
+
 2012-02-10  Leo Liu  <address@hidden>
 
        * subr.el (condition-case-unless-debug): Rename from

=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2012-02-09 23:30:27 +0000
+++ b/lisp/gnus/ChangeLog       2012-02-10 18:16:19 +0000
@@ -1,3 +1,8 @@
+2012-02-10  Lars Ingebrigtsen  <address@hidden>
+
+       * message.el (message-default-send-mail-function): Made into own
+       function for reuse by emacsbug.el.
+
 2012-02-09  Juanma Barranquero  <address@hidden>
 
        * gnus.el (gnus-method-ephemeral-p): Move after declaration of defsubst

=== modified file 'lisp/gnus/message.el'
--- a/lisp/gnus/message.el      2012-01-19 07:21:25 +0000
+++ b/lisp/gnus/message.el      2012-02-10 18:16:19 +0000
@@ -655,14 +655,16 @@
        (t
         (error "Don't know how to send mail.  Please customize 
`message-send-mail-function'"))))
 
-;; Useful to set in site-init.el
-(defcustom message-send-mail-function
+(defun message-default-send-mail-function ()
   (cond ((eq send-mail-function 'smtpmail-send-it) 'message-smtpmail-send-it)
        ((eq send-mail-function 'feedmail-send-it) 'feedmail-send-it)
        ((eq send-mail-function 'sendmail-query-once) 'sendmail-query-once)
        ((eq send-mail-function 'mailclient-send-it)
         'message-send-mail-with-mailclient)
-       (t (message-send-mail-function)))
+       (t (message-send-mail-function))))
+
+;; Useful to set in site-init.el
+(defcustom message-send-mail-function (message-default-send-mail-function)
   "Function to call to send the current buffer as mail.
 The headers should be delimited by a line whose contents match the
 variable `mail-header-separator'.

=== modified file 'lisp/mail/emacsbug.el'
--- a/lisp/mail/emacsbug.el     2012-02-09 03:29:41 +0000
+++ b/lisp/mail/emacsbug.el     2012-02-10 18:16:19 +0000
@@ -32,6 +32,9 @@
 
 ;;; Code:
 
+(require 'sendmail)
+(require 'message)
+
 (defgroup emacsbug nil
   "Sending Emacs bug reports."
   :group 'maint
@@ -365,26 +368,7 @@
          (string-equal (buffer-substring-no-properties (point-min) (point))
                        report-emacs-bug-orig-text)
          (error "No text entered in bug report"))
-    (or report-emacs-bug-no-confirmation
-       ;; mailclient.el does not handle From (at present).
-       (if (derived-mode-p 'message-mode)
-           (eq message-send-mail-function 'message-send-mail-with-mailclient)
-         (eq send-mail-function 'mailclient-send-it))
-       ;; Not narrowing to the headers, but that's OK.
-       (let ((from (mail-fetch-field "From")))
-         (and (or (not from)
-                  (message-bogus-recipient-p from)
-                  ;; This is the default user-mail-address.  On today's
-                  ;; systems, it seems more likely to be wrong than right,
-                  ;; since most people don't run their own mail server.
-                  (string-match (format "\\<address@hidden>"
-                                        (regexp-quote (user-login-name))
-                                        (regexp-quote (system-name)))
-                                from))
-              (not (yes-or-no-p
-                    (format "Is `%s' really your email address? " from)))
-              (error "Please edit the From address and try again"))))
-    ;; The last warning for novice users.
+    ;; Warning for novice users.
     (unless (or report-emacs-bug-no-confirmation
                (yes-or-no-p
                 "Send this bug report to the Emacs maintainers? "))
@@ -407,7 +391,32 @@
                                     report-emacs-bug-send-command)
                           "")))))
       (error "M-x report-emacs-bug was cancelled, 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.
+    (when (eq send-mail-function 'sendmail-query-once)
+      (sendmail-query-user-about-smtp)
+      (when (derived-mode-p 'message-mode)
+       (setq message-send-mail-function (message-default-send-mail-function))))
+    (or report-emacs-bug-no-confirmation
+       ;; mailclient.el does not need a valid From
+       (if (derived-mode-p 'message-mode)
+           (eq message-send-mail-function 'message-send-mail-with-mailclient)
+         (eq send-mail-function 'mailclient-send-it))
+       ;; Not narrowing to the headers, but that's OK.
+       (let ((from (mail-fetch-field "From")))
+         (and (or (not from)
+                  (message-bogus-recipient-p from)
+                  ;; This is the default user-mail-address.  On today's
+                  ;; systems, it seems more likely to be wrong than right,
+                  ;; since most people don't run their own mail server.
+                  (string-match (format "\\<address@hidden>"
+                                        (regexp-quote (user-login-name))
+                                        (regexp-quote (system-name)))
+                                from))
+              (not (yes-or-no-p
+                    (format "Is `%s' really your email address? " from)))
+              (error "Please edit the From address and try again"))))
     ;; Delete the uninteresting text that was just to help fill out the report.
     (rfc822-goto-eoh)
     (forward-line 1)

=== modified file 'lisp/mail/sendmail.el'
--- a/lisp/mail/sendmail.el     2012-01-19 07:21:25 +0000
+++ b/lisp/mail/sendmail.el     2012-02-10 18:16:19 +0000
@@ -513,48 +513,51 @@
   ;; a second time, probably because someone's using an old value
   ;; of send-mail-function.
   (when (eq send-mail-function 'sendmail-query-once)
-    (let* ((options `(("mail client" . mailclient-send-it)
-                      ,@(when (and sendmail-program
-                                   (executable-find sendmail-program))
-                          '(("transport" . sendmail-send-it)))
-                      ("smtp" . smtpmail-send-it)))
-           (choice
-            ;; Query the user.
-            (with-temp-buffer
-              (rename-buffer "*Emacs Mail Setup Help*" t)
-              (insert "\
+    (sendmail-query-user-about-smtp))
+  (funcall send-mail-function))
+
+(defun sendmail-query-user-about-smtp ()
+  (let* ((options `(("mail client" . mailclient-send-it)
+                   ,@(when (and sendmail-program
+                                (executable-find sendmail-program))
+                       '(("transport" . sendmail-send-it)))
+                   ("smtp" . smtpmail-send-it)))
+        (choice
+         ;; Query the user.
+         (with-temp-buffer
+           (rename-buffer "*Emacs Mail Setup Help*" t)
+           (insert "\
  Emacs is about to send an email message, but it has not been
  configured for sending email.  To tell Emacs how to send email:
 
  - Type `"
-                     (propertize "mail client" 'face 'bold)
-                     "' to start your default email client and
+                   (propertize "mail client" 'face 'bold)
+                   "' to start your default email client and
    pass it the message text.\n\n")
-             (and sendmail-program
-                  (executable-find sendmail-program)
-                  (insert "\
+           (and sendmail-program
+                (executable-find sendmail-program)
+                (insert "\
  - Type `"
-                          (propertize "transport" 'face 'bold)
-                          "' to invoke the system's mail transport agent
+                        (propertize "transport" 'face 'bold)
+                        "' to invoke the system's mail transport agent
    (the `"
-                          sendmail-program
-                          "' program).\n\n"))
-             (insert "\
+                        sendmail-program
+                        "' program).\n\n"))
+           (insert "\
  - Type `"
-                     (propertize "smtp" 'face 'bold)
-                     "' to send mail directly to an \"outgoing mail\" server.
+                   (propertize "smtp" 'face 'bold)
+                   "' to send mail directly to an \"outgoing mail\" server.
    (Emacs may prompt you for SMTP settings).
 
  Emacs will record your selection and will use it thereafter.
  To change it later, customize the option `send-mail-function'.\n")
-              (goto-char (point-min))
-              (display-buffer (current-buffer))
-              (let ((completion-ignore-case t))
-                (completing-read "Send mail via: "
-                                 options nil 'require-match)))))
-      (customize-save-variable 'send-mail-function
-                               (cdr (assoc-string choice options t)))))
-  (funcall send-mail-function))
+           (goto-char (point-min))
+           (display-buffer (current-buffer))
+           (let ((completion-ignore-case t))
+             (completing-read "Send mail via: "
+                              options nil 'require-match)))))
+    (customize-save-variable 'send-mail-function
+                            (cdr (assoc-string choice options t)))))
 
 (defun sendmail-sync-aliases ()
   (when mail-personal-alias-file


reply via email to

[Prev in Thread] Current Thread [Next in Thread]