[Top][All Lists]

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

Mailutils movemail

From: Sergey Poznyakoff
Subject: Mailutils movemail
Date: Mon, 19 Jan 2004 13:46:34 +0200


GNU Mailutils finally has its implementation of movemail program. This
implementation supports both pop3 and imap4 protocols. It also supports
both traditional movemail command line syntax and usual GNU long options.
Attached is a patch to rmail.el that enables it to make use of the
additional movemail options. The diff was made against emacs version
21.3, but it applies to the CVS version as well.


--- /usr/src/emacs-21.3/lisp/mail/rmail.el      Sat Jul  6 17:17:02 2002
+++ rmail.el    Tue Dec 30 16:58:27 2003
@@ -130,7 +130,44 @@ rather than deleted, after it is retriev
   :type 'boolean
   :group 'rmail-retrieve)
+(defvar rmail-movemail-variant-in-use nil
+  "The movemail variant currently in use. Known variants are 'emacs (the
+default) and 'mailutils")
+(defun rmail-movemail-variant-p (&rest variants)
+    "Return t if the current movemail variant is any of VARIANTS.
+Currently known variants are 'emacs and 'mailutils."
+    (if (not rmail-movemail-variant-in-use)
+       ;; Autodetect
+       (setq rmail-movemail-variant-in-use
+             (unwind-protect
+                 (save-excursion
+                   (setq errors (generate-new-buffer "*rmail autodetect*"))
+                   (buffer-disable-undo errors)
+                   (let ((args 
+                          (append 
+                           (list (or rmail-movemail-program
+                                     (expand-file-name "movemail"
+                                                       exec-directory))
+                                 nil errors nil)
+                           (list "--version"))))
+                     (apply 'call-process args))
+                   (if (not (buffer-modified-p errors))
+                       ;; Should not happen...
+                       'emacs
+                     (set-buffer errors)
+                     (goto-char (point-min))
+                     (cond
+                      ((looking-at ".*movemail: invalid option")
+                       'emacs)    ;; Possibly...
+                      ((looking-at "movemail (GNU Mailutils .*)")
+                       'mailutils)
+                      (t
+                       ;; FIXME:
+                       'emacs)))))))
+    (not (null (member rmail-movemail-variant-in-use variants))))
 (defcustom rmail-dont-reply-to-names nil "\
 *A regexp specifying names to prune of reply to messages.
 A value of nil means exclude your own login name as an address
@@ -1467,7 +1504,9 @@ It returns t if it got any new messages.
       ;; Handle POP mailbox names specially; don't expand as filenames
       ;; in case the userid contains a directory separator.
       (setq file (car files))
-      (setq popmail (string-match "^po:" file))
+      (setq popmail (or (string-match "^po:" file)
+                       (and (rmail-movemail-variant-p 'mailutils)
+                            (string-match "pop://\\|imap://" file))))
       (if popmail
          (setq renamep t)
        (setq file (file-truename

reply via email to

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