all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el
@ 2013-04-26  0:18 Monte Stevens
  2013-04-26  2:37 ` Katsumi Yamaoka
  0 siblings, 1 reply; 7+ messages in thread
From: Monte Stevens @ 2013-04-26  0:18 UTC (permalink / raw)
  To: 14271

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'

pop servers definitions:

      mail-sources
      '(
        (pop
         :server "pop.eastlink.ca"
         :user "my-blacked-out-user-name1"
         :password "my-blacked-password1")
        (pop
         :server "pop.mail.yahoo.ca"
         :user "my-blacked-out-user-name2"
         :password "my-blacked-password2"))

I believe MAILHOST is set in mail-source.el in mail-source-fetch-pop.  I
don't know why it needs to be set if I am using pop3.el .

The reason that this is a problem for me is that future mail from my
local user appear as `From: monte@pop.eastlink.ca' .



In GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2013-04-15 on cletus
System Description:	Debian GNU/Linux 7.0 (wheezy)

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  erc-fill-mode: t
  erc-track-mode: t
  erc-autojoin-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
~ ESC [ 6 ~ ESC [ 6 ~ ESC [ 6 ~ ESC [ 6 ~ ESC [ 6 ~ 
ESC [ 6 ~ ESC [ 6 ~ ESC [ 6 ~ C-s s e t e ESC x r e 
p o r t TAB RET C-g ESC x g n u s RET ESC x g e t e 
n v TAB RET M A I L H O S T RET q y ESC x ESC O A RET 
ESC O A RET ESC x s e t e n TAB RET M A I L H TAB RET 
RET ESC x ESC O A ESC O A RET ESC O A RET C-h i m g 
n u s RET C-s o p DEL DEL p o p RET C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s RET ESC [ 6 ~ ESC [ 6 ~ ESC 
[ 6 ~ ESC [ 5 ~ ESC [ 6 ~ ESC [ 6 ~ C-x b C-g C-x C-f 
. g n u s TAB C-a C-k ~ / . g n u s TAB RET ESC O B 
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC 
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B 
ESC O B ESC O B ESC O B ESC O B C-x b RET C-x b m a 
i l TAB RET C-r s e r v e r ESC x r e p o TAB r t TAB 
RET

Recent messages:
pop.eastlink.ca
Are you sure you want to quit reading news? (y or n)  y
(No changes need to be saved)
pop.eastlink.ca

Composing main Info directory...done
Mark saved where search started [2 times]
Quit
Mark saved where search started
Making completion list...

Load-path shadows:
/usr/local/share/emacs/site-lisp/flim/md4 hides /usr/local/share/emacs/24.3/lisp/md4
/usr/local/share/emacs/site-lisp/flim/hex-util hides /usr/local/share/emacs/24.3/lisp/hex-util
/usr/local/share/emacs/site-lisp/flim/hmac-def hides /usr/local/share/emacs/24.3/lisp/net/hmac-def
/usr/local/share/emacs/site-lisp/flim/sasl-digest hides /usr/local/share/emacs/24.3/lisp/net/sasl-digest
/usr/local/share/emacs/site-lisp/flim/sasl-ntlm hides /usr/local/share/emacs/24.3/lisp/net/sasl-ntlm
/usr/local/share/emacs/site-lisp/flim/sasl-cram hides /usr/local/share/emacs/24.3/lisp/net/sasl-cram
/usr/local/share/emacs/site-lisp/flim/sasl hides /usr/local/share/emacs/24.3/lisp/net/sasl
/usr/local/share/emacs/site-lisp/flim/ntlm hides /usr/local/share/emacs/24.3/lisp/net/ntlm
/usr/local/share/emacs/site-lisp/flim/hmac-md5 hides /usr/local/share/emacs/24.3/lisp/net/hmac-md5

Features:
(shadow sort bbdb-message mail-extr jka-compr info emacsbug sendmail
misearch multi-isearch help-mode mm-archive url-http url-gw url-cache
url-auth url-handlers tramp-cache tramp-sh network-stream starttls tls
pop3 nnrss xml mm-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse url-vars nndraft
nnmh nnfolder bbdb-gnus nnnil gnus-agent gnus-srvr gnus-score score-mode
nnvirtual nntp gnus-cache org-publish org-exp ob-exp org-exp-blocks
org-agenda org warnings ob-tangle ob-ref ob-lob ob-table org-footnote
org-src ob-comint ob-keys org-pcomplete org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob org-compat org-macs
ob-eval org-loaddefs find-func cal-menu calendar cal-loaddefs tramp
tramp-compat tramp-loaddefs shell pcomplete advice advice-preload
erc-fill erc-stamp erc-track erc-match erc-join erc-goodies erc
erc-backend erc-compat auth-source eieio cookie1 spam spam-stat gnus-uu
yenc gnus-msg gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime
password-cache dig mailcap gnus-sum nnoo gnus-group gnus-undo nnmail
mail-source gnus-start gnus-spec gnus-int gnus-range gnus-win message
format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums gmm-utils mailheader gnus-hardsort
gnus gnus-ems nnheader gnus-util time-date mail-utils mm-util mail-prsvr
wid-edit bbdb-mua bbdb-com mailabbrev bbdb timezone bbdb-loaddefs
w3m-load slime byte-opt bytecomp byte-compile cconv derived help-fns
edmacro kmacro easy-mmode easymenu pp comint ansi-color ring hyperspec
cl-macs gv thingatpt browse-url cl cl-lib time server tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

-- 
Fry: Greetings Moon Man!  We come in peace.  I am Fry, from the planet
  Earth.
Sal: Wise guy, huh?  If I wasn't so lazy, I'd punch you in the
  stomach.
Fry: But you are lazy, right?
Sal: Ahh, don't get me started!





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el
  2013-04-26  0:18 bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el Monte Stevens
@ 2013-04-26  2:37 ` Katsumi Yamaoka
  2013-04-26  7:01   ` Glenn Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2013-04-26  2:37 UTC (permalink / raw)
  To: Monte Stevens; +Cc: 14271

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

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.)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1014 bytes --]

--- 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))))))
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el
  2013-04-26  2:37 ` Katsumi Yamaoka
@ 2013-04-26  7:01   ` Glenn Morris
  2013-04-26 10:22     ` Katsumi Yamaoka
  0 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2013-04-26  7:01 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 14271, Monte Stevens

Katsumi Yamaoka wrote:

> 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.)

It might be simpler to let-bind process-environment?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el
  2013-04-26  7:01   ` Glenn Morris
@ 2013-04-26 10:22     ` Katsumi Yamaoka
  2013-04-26 10:42       ` Katsumi Yamaoka
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2013-04-26 10:22 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14271-done, Monte Stevens

Glenn Morris wrote:
> It might be simpler to let-bind process-environment?

Ah, thanks.

(shell-command-to-string "echo -n $MAILHOST")
 => ""

(let* ((server "mail.example.com")
       (process-environment (append (list (concat "MAILHOST=" server))
				    process-environment)))
  (shell-command-to-string "echo -n $MAILHOST"))
 => "mail.example.com"

(let* ((server nil)
       (process-environment (append (list (concat "MAILHOST=" server))
				    process-environment)))
  (shell-command-to-string "echo -n $MAILHOST"))
 => ""

I've done it in this way.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el
  2013-04-26 10:22     ` Katsumi Yamaoka
@ 2013-04-26 10:42       ` Katsumi Yamaoka
  2013-04-26 13:26         ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2013-04-26 10:42 UTC (permalink / raw)
  To: 14271; +Cc: Monte Stevens

Katsumi Yamaoka wrote:
> (shell-command-to-string "echo -n $MAILHOST")
>  => ""

> (let* ((server "mail.example.com")
>        (process-environment (append (list (concat "MAILHOST=" server))
> 				    process-environment)))
>   (shell-command-to-string "echo -n $MAILHOST"))
>  => "mail.example.com"

> (let* ((server nil)
>        (process-environment (append (list (concat "MAILHOST=" server))
> 				    process-environment)))
>   (shell-command-to-string "echo -n $MAILHOST"))
>  => ""

> I've done it in this way.

Oops, it should also have been:

(setenv "MAILHOST" "mail.example.com")

(let* ((server nil)
       (process-environment (if server
				(append (list (concat "MAILHOST=" server))
					process-environment)
			      process-environment)))
  (shell-command-to-string "echo -n $MAILHOST"))
 => "mail.example.com"

Fixed.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el
  2013-04-26 10:42       ` Katsumi Yamaoka
@ 2013-04-26 13:26         ` Stefan Monnier
  2013-04-26 13:56           ` Katsumi Yamaoka
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-04-26 13:26 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 14271, Monte Stevens

> 				(append (list (concat "MAILHOST=" server))
> 					process-environment)

Also known as (cons (concat "MAILHOST=" server) process-environment)


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el
  2013-04-26 13:26         ` Stefan Monnier
@ 2013-04-26 13:56           ` Katsumi Yamaoka
  0 siblings, 0 replies; 7+ messages in thread
From: Katsumi Yamaoka @ 2013-04-26 13:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14271, Monte Stevens

Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> 				(append (list (concat "MAILHOST=" server))
>> 					process-environment)

> Also known as (cons (concat "MAILHOST=" server) process-environment)

Indeed.  Thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-26 13:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26  0:18 bug#14271: 24.3; MAILHOST set in mail-source.el when using pop3.el Monte Stevens
2013-04-26  2:37 ` Katsumi Yamaoka
2013-04-26  7:01   ` Glenn Morris
2013-04-26 10:22     ` Katsumi Yamaoka
2013-04-26 10:42       ` Katsumi Yamaoka
2013-04-26 13:26         ` Stefan Monnier
2013-04-26 13:56           ` Katsumi Yamaoka

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.