Merge from emacs--devo--0
[gnus] / lisp / message.el
index afcb142..82dd24c 100644 (file)
@@ -8,20 +8,18 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, 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
+;; 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., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -569,7 +567,13 @@ Done before generating the new subject of a forward."
   :link '(custom-manual "(message)Forwarding")
   :type 'boolean)
 
-(defcustom message-ignored-resent-headers "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From "
+(defcustom message-ignored-resent-headers
+  ;; `Delivered-To' needs to be removed because some mailers use it to
+  ;; detect loops, so if you resend a message to an address that ultimately
+  ;; comes back to you (e.g. a mailing-list to which you subscribe, in which
+  ;; case you may be removed from the list on the grounds that mail to you
+  ;; bounced with a "mailing loop" error).
+  "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From \\|^Delivered-To:"
   "*All headers that match this regexp will be deleted when resending a message."
   :group 'message-interface
   :link '(custom-manual "(message)Resending")
@@ -2483,6 +2487,7 @@ Point is left at the beginning of the narrowed-to region."
 
 
 (autoload 'Info-goto-node "info")
+(defvar mml2015-use)
 
 (defun message-info (&optional arg)
   "Display the Message manual.
@@ -2491,8 +2496,11 @@ Prefixed with one \\[universal-argument], display the Emacs MIME
 manual.  With two \\[universal-argument]'s, display the EasyPG or
 PGG manual, depending on the value of `mml2015-use'."
   (interactive "p")
+  ;; Why not `info', which is in loaddefs.el?
   (Info-goto-node (format "(%s)Top"
-                         (cond ((eq arg 16) mml2015-use)
+                         (cond ((eq arg 16)
+                                (require 'mml2015)
+                                mml2015-use)
                                ((eq arg  4) 'emacs-mime)
                                ;; `booleanp' only available in Emacs 22+
                                ((and (not (memq arg '(nil t)))
@@ -4056,7 +4064,15 @@ not have PROP."
   "Regexp of potentially bogus mail addresses."
   :version "23.1" ;; No Gnus
   :group 'message-headers
-  :type 'regexp)
+  :type '(choice (const :tag "None" nil)
+                (repeat :value-to-internal (lambda (widget value)
+                                             (custom-split-regexp-maybe value))
+                        :match (lambda (widget value)
+                                 (or (stringp value)
+                                     (widget-editable-list-match widget value)))
+                        regexp)
+                (const "noreply\\|nospam\\|invalid")
+                regexp))
 
 (defun message-fix-before-sending ()
   "Do various things to make the message nice before sending it."
@@ -4142,7 +4158,7 @@ not have PROP."
          (forward-char)
          (skip-chars-forward mm-7bit-chars)))))
   (message-check 'bogus-recipient
-    ;; Warn before composing or sending a mail to an invalid address.
+    ;; Warn before sending a mail to an invalid address.
     (message-check-recipients)))
 
 (defun message-bogus-recipient-p (recipients)
@@ -4189,6 +4205,8 @@ This function could be useful in `message-setup-hook'."
                        "Address `%s' might be bogus.  Continue? " bog)))
                 (error "Bogus address."))))))))
 
+(custom-add-option 'message-setup-hook 'message-check-recipients)
+
 (defun message-add-action (action &rest types)
   "Add ACTION to be performed when doing an exit of type TYPES."
   (while types
@@ -5339,19 +5357,18 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'."
                   ;; Quote a string containing non-ASCII characters.
                   ;; It will make the RFC2047 encoder cause an error
                   ;; if there are special characters.
-                  (let ((default-enable-multibyte-characters t))
-                    (with-temp-buffer
-                      (insert (car name))
-                      (goto-char (point-min))
-                      (while (search-forward "\"" nil t)
-                        (when (prog2
-                                  (backward-char)
-                                  (zerop (% (skip-chars-backward "\\\\") 2))
-                                (goto-char (match-beginning 0)))
-                          (insert "\\"))
-                        (forward-char))
-                      ;; Those quotes will be removed by the RFC2047 encoder.
-                      (concat "\"" (buffer-string) "\"")))
+                   (mm-with-multibyte-buffer
+                     (insert (car name))
+                     (goto-char (point-min))
+                     (while (search-forward "\"" nil t)
+                       (when (prog2
+                                 (backward-char)
+                                 (zerop (% (skip-chars-backward "\\\\") 2))
+                               (goto-char (match-beginning 0)))
+                         (insert "\\"))
+                       (forward-char))
+                     ;; Those quotes will be removed by the RFC2047 encoder.
+                     (concat "\"" (buffer-string) "\""))
                 (car name))
             (nth 1 name))
           "'s message of \""