bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el


From: Katsumi Yamaoka
Subject: bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el
Date: Fri, 26 Apr 2013 11:37:36 +0900
User-agent: Gnus/5.130006 (真 Gnus v0.6) Emacs/24.3.50 (i686-pc-cygwin)

Monte Stevens wrote:
> My MAILHOST environment variable is empty.
> I start emacs with `emacsclient -ta "" foo'.
> `M-x getenv MAILHOST' = ''

> I start Gnus with `M-x gnus'; Gnus fetches mail from two pop servers as
> defined in my .gnus.el file.
> `M-x getenv MAILHOST' = 'pop.eastlink.ca'
[...]
> The reason that this is a problem for me is that future mail from my
> local user appear as `From: monte@pop.eastlink.ca' .

Maybe setting MAILHOST is necessary for a user who uses a movemail
program that is not that of pop3.el.  But it should be needed only
when running that program.  So, I'd like to modify the pop3.el code
so that it binds MAILHOST temporarily.  A patch for Emacs 24.3 is
below.  Could others review it?  (I'm going to commit it only to
the trunk.)

--- mail-source.el~     2013-01-01 20:37:17.000000000 +0000
+++ mail-source.el      2013-04-26 02:34:39.395042300 +0000
@@ -799,3 +799,3 @@
          (mail-source-string (format "pop:%s@%s" user server))
-         result)
+         omailhost result)
       (when (eq authentication 'password)
@@ -807,3 +807,6 @@
       (when server
+       (setq omailhost (getenv "MAILHOST"))
        (setenv "MAILHOST" server))
+(unwind-protect
+    (progn
       (setq result
@@ -859,3 +862,6 @@
                    mail-source-password-cache))
-       0))))
+       0))
+  (when server
+    (setenv "MAILHOST" omailhost))))))
+
 
@@ -866,3 +872,3 @@
          (mail-source-string (format "pop:%s@%s" user server))
-         result)
+         omailhost result)
       (when (eq authentication 'password)
@@ -876,3 +882,6 @@
       (when server
+       (setq omailhost (getenv "MAILHOST"))
        (setenv "MAILHOST" server))
+(unwind-protect
+    (progn
       (setq result
@@ -910,3 +919,5 @@
                    mail-source-password-cache)))
-      result)))
+      result)
+  (when server
+    (setenv "MAILHOST" omailhost))))))
 

reply via email to

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