]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/nnmail.el
; Merge from origin/emacs-25
[gnu-emacs] / lisp / gnus / nnmail.el
index 2292849ccb18e72bfad7bfc6768dbcc3f2ee9378..94589e1734d5183748a19a8f31fbf92e72015720 100644 (file)
@@ -1,6 +1,6 @@
 ;;; nnmail.el --- mail support functions for the Gnus mail backends
 
-;; Copyright (C) 1995-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2016 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news, mail
@@ -83,7 +83,7 @@ If you'd like, for instance, one mail group for mail from the
 else, you could do something like this:
 
  (setq nnmail-split-methods
-       '((\"mail.4ad\" \"From:.*4ad\")
+       \\='((\"mail.4ad\" \"From:.*4ad\")
         (\"mail.junk\" \"From:.*Lars\\\\|Subject:.*buy\")
         (\"mail.misc\" \"\")))
 
@@ -180,7 +180,7 @@ E.g.:
       (lambda (newsgroup)
        (cond ((string-match \"private\" newsgroup) 31)
              ((string-match \"junk\" newsgroup) 1)
-             ((string-match \"important\" newsgroup) 'never)
+             ((string-match \"important\" newsgroup) \\='never)
              (t 7))))"
   :group 'nnmail-expire
   :type '(choice (const :tag "nnmail-expiry-wait" nil)
@@ -217,7 +217,7 @@ will try to match against both the From and the To header.
 Example:
 
 \(setq nnmail-fancy-expiry-targets
-      '((to-from \"boss\" \"nnfolder:Work\")
+      \\='((to-from \"boss\" \"nnfolder:Work\")
        (\"Subject\" \"IMPORTANT\" \"nnfolder:IMPORTANT.%Y.%b\")
        (\"from\" \".*\" \"nnfolder:Archive-%Y\")))
 
@@ -368,34 +368,7 @@ messages will be shown to indicate the current status."
   :type '(choice (const :tag "infinite" nil)
                  (number :tag "count")))
 
-(define-widget 'nnmail-lazy 'default
-  "Base widget for recursive data structures.
-
-This is copy of the `lazy' widget in Emacs 22.1 provided for compatibility."
-  :format "%{%t%}: %v"
-  :convert-widget 'widget-value-convert-widget
-  :value-create (lambda (widget)
-                  (let ((value (widget-get widget :value))
-                        (type (widget-get widget :type)))
-                    (widget-put widget :children
-                                (list (widget-create-child-value
-                                       widget (widget-convert type) value)))))
-  :value-delete 'widget-children-value-delete
-  :value-get (lambda (widget)
-               (widget-value (car (widget-get widget :children))))
-  :value-inline (lambda (widget)
-                  (widget-apply (car (widget-get widget :children))
-                                :value-inline))
-  :default-get (lambda (widget)
-                 (widget-default-get
-                  (widget-convert (widget-get widget :type))))
-  :match (lambda (widget value)
-           (widget-apply (widget-convert (widget-get widget :type))
-                         :match value))
-  :validate (lambda (widget)
-              (widget-apply (car (widget-get widget :children)) :validate)))
-
-(define-widget 'nnmail-split-fancy 'nnmail-lazy
+(define-widget 'nnmail-split-fancy 'lazy
   "Widget for customizing splits in the variable of the same name."
   :tag "Split"
   :type '(menu-choice :value (any ".*value.*" "misc")
@@ -465,7 +438,7 @@ GROUP: Mail will be stored in GROUP (a string).
 junk: Mail will be deleted.  Use with care!  Do not submerge in water!
   Example:
   (setq nnmail-split-fancy
-       '(| (\"Subject\" \"MAKE MONEY FAST\" junk)
+       \\='(| (\"Subject\" \"MAKE MONEY FAST\" junk)
            ...other.rules.omitted...))
 
 FIELD must match a complete field name.  VALUE must match a complete
@@ -628,14 +601,7 @@ using different case (i.e. mailing-list@domain vs Mailing-List@Domain)."
   mm-text-coding-system
   "Coding system used in reading inbox")
 
-(defvar nnmail-pathname-coding-system
-  ;; This causes Emacs 22.2 and 22.3 to issue a useless warning.
-  ;;(if (and (featurep 'xemacs) (featurep 'file-coding))
-  (if (featurep 'xemacs)
-      (if (featurep 'file-coding)
-         ;; Work around a bug in many XEmacs 21.5 betas.
-         ;; Cf. http://thread.gmane.org/gmane.emacs.gnus.general/68134
-         (setq file-name-coding-system (coding-system-aliasee 'file-name))))
+(defvar nnmail-pathname-coding-system nil
   "*Coding system for file name.")
 
 (defun nnmail-find-file (file)
@@ -697,7 +663,7 @@ nn*-request-list should have been called before calling this function."
              (setq group (symbol-name group)))
            (if (and (numberp (setq max (read buffer)))
                     (numberp (setq min (read buffer))))
-               (push (list (mm-string-as-unibyte group) (cons min max))
+               (push (list (string-as-unibyte group) (cons min max))
                      group-assoc)))
        (error nil))
       (widen)
@@ -1173,7 +1139,7 @@ FUNC will be called with the group name to determine the article number."
                        5 "Error in `nnmail-split-methods'; using `bogus' mail group: %S" error-info)
                       (sit-for 1)
                       '("bogus")))))
-             (setq split (mm-delete-duplicates split))
+             (setq split (delete-dups split))
              ;; The article may be "cross-posted" to `junk'.  What
              ;; to do?  Just remove the `junk' spec.  Don't really
              ;; see anything else to do...
@@ -1279,9 +1245,9 @@ Return the number of characters in the body."
     (insert (format "Xref: %s" (system-name)))
     (while group-alist
       (insert (if (mm-multibyte-p)
-                 (mm-string-as-multibyte
+                 (string-as-multibyte
                   (format " %s:%d" (caar group-alist) (cdar group-alist)))
-               (mm-string-as-unibyte
+               (string-as-unibyte
                 (format " %s:%d" (caar group-alist) (cdar group-alist)))))
       (setq group-alist (cdr group-alist)))
     (insert "\n")))
@@ -1792,6 +1758,12 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
   "Read new incoming mail."
   (nnmail-get-new-mail-1 method exit-func temp group nil spool-func))
 
+(defun nnmail-get-new-mail-per-group ()
+  "Tell us whether the mail-sources specify that `nnmail-get-new-mail' should
+be called once per group or once for all groups."
+  (or (assq 'group mail-sources)
+      (assq 'directory mail-sources)))
+
 (defun nnmail-get-new-mail-1 (method exit-func temp
                              group in-group spool-func)
   (let* ((sources mail-sources)
@@ -1804,7 +1776,8 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
               sources)
       (while (setq source (pop sources))
        ;; Use group's parameter
-       (when (eq (car source) 'group)
+       (when (and (eq (car source) 'group)
+                  group)
          (let ((mail-sources
                 (list
                  (gnus-group-find-parameter
@@ -1950,10 +1923,8 @@ If TIME is nil, then return the cutoff time for oldness instead."
        ((and (equal header 'to-from)
             (or (string-match (cadr regexp-target-pair) from)
                 (and (string-match (cadr regexp-target-pair) to)
-                     (let* ((mail-dont-reply-to-names
-                             (message-dont-reply-to-names))
-                            (rmail-dont-reply-to-names ; obsolete since 24.1
-                             mail-dont-reply-to-names))
+                     (let ((mail-dont-reply-to-names
+                            (message-dont-reply-to-names)))
                        (equal (if (fboundp 'rmail-dont-reply-to)
                                   (rmail-dont-reply-to from)
                                 (mail-dont-reply-to from)) "")))))
@@ -2047,13 +2018,13 @@ If TIME is nil, then return the cutoff time for oldness instead."
     (error "No current split history"))
   (with-output-to-temp-buffer "*nnmail split history*"
     (with-current-buffer standard-output
-      (fundamental-mode))              ; for Emacs 20.4+
-      (dolist (elem nnmail-split-history)
-       (princ (mapconcat (lambda (ga)
-                           (concat (car ga) ":" (int-to-string (cdr ga))))
-                         elem
-                         ", "))
-       (princ "\n"))))
+      (fundamental-mode))
+    (dolist (elem nnmail-split-history)
+      (princ (mapconcat (lambda (ga)
+                         (concat (car ga) ":" (int-to-string (cdr ga))))
+                       elem
+                       ", "))
+      (princ "\n"))))
 
 (defun nnmail-purge-split-history (group)
   "Remove all instances of GROUP from `nnmail-split-history'."