Subject: 27.1; mail-archive-file-name cannot be changed once it is set.

From: Muto <[email-masked]>
Date: Thu, 21 Jan 2021 22:19:31 -0700

This bug occurs even if I disable my configuration. The variable
'mail-archive-file-name' can be set, but never re-set afterwards
(setting it to nil before providing a new value does not work, either).

I use rmail and Mailutils to check my email, and I switch back and forth
between two accounts by using the following functions:

;; My first account
(defun mail-muto ()
  (interactive)
  (setq
   rmail-primary-inbox-list
   (list (concat "imaps://shack%40muto.ca"
		 "@mail.gandi.net"))
   rmail-file-name "~/.emacs.d/mymail/muto/muto"
   rmail-default-file "~/.emacs.d/mymail/muto/muto"
   mail-archive-file-name "~/.emacs.d/mymail/muto/sent"
   user-mail-address "[email-masked]"
   user-full-name "Muto"
   smtpmail-default-smtp-server "mail.gandi.net"
   message-signature "Rock on! -Muto\nhttps://muto.ca")
   (message "%s"(propertize "Email account: Muto")))

;; A second account that is uses all the same variables.
(defun mail-muto2 ()
  (interactive)
  (setq
   rmail-primary-inbox-list
   (list (concat "imaps://muto2%40example.com"
		 "@mail.example.com"))
   rmail-file-name "~/.emacs.d/mymail/muto2/muto2"
   rmail-default-file "~/.emacs.d/mymail/muto2/muto2"
   mail-archive-file-name "~/.emacs.d/mymail/muto2/sent"
   user-mail-address "[email-masked]"
   user-full-name "Muto2"
   smtpmail-default-smtp-server "mail.example.com"
   message-signature "Regards, -Muto2. ")
  (message "%s"(propertize "Email account: Muto2")))

;; End of code snippit

If I activate my first account with:
  M-x mail-muto
and start a new email with
  C-x m
The Fcc line will look correct.

But after that, if I use
  M-x mail-muto2
And start writing a new email, my signature, return address, and full
name are updated, but my Fcc still has the old value of:
  "~/.emacs.d/mymail/muto/sent"
instead of the desired value:
  "~/.emacs.d/mymail/muto2/sent"

This bug works the other way around (loading account 2 first), and it
also occurs when I use 'mail-default-headers' instead of
'mail-archive-file-name'. 

In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Linux Mint 20.1

Recent messages:
Loading /home/melon/.emacs.d/custom.el (source)...
Loading paren...done
Loading /home/melon/.emacs.d/custom.el (source)...done
Starting Emacs daemon.
When done with this frame, type C-x 5 0
Email account: Muto
Making completion list...

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash
 SHELL=/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash
 --prefix=/gnu/store/8s3kp73c9qds8ychbhnk2h9b30aa84aa-emacs-27.1
 --enable-fast-install --with-modules --with-cairo
 --disable-build-details'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS JSON PDUMPER
GMP

Important settings:
  value of $EMACSLOADPATH: /gnu/store/m5g5fzfbf25nc158swka8y6fw0nh1mgp-profile/share/emacs/site-lisp:/gnu/store/m5g5fzfbf25nc158swka8y6fw0nh1mgp-profile/share/emacs/27.1/lisp
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-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

Load-path shadows:
~/.emacs.d/lisp/jsonrpc hides /gnu/store/m5g5fzfbf25nc158swka8y6fw0nh1mgp-profile/share/emacs/27.1/lisp/jsonrpc

Features:
(shadow sort mail-extr warnings emacsbug message rmc puny format-spec
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils server
pnk-theme paren cus-start cus-load dired-x dired dired-loaddefs
moe-theme multiple-cursors mc-hide-unmatched-lines-mode
mc-separate-operations rectangular-region-mode mc-mark-pop mc-mark-more
thingatpt mc-cycle-cursors mc-edit-lines multiple-cursors-core advice
rect finder-inf guix-emacs info slime-autoloads package easymenu
browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 84307 9536)
 (symbols 48 9933 1)
 (strings 32 29749 2491)
 (string-bytes 1 895302)
 (vectors 16 14514)
 (vector-slots 8 181363 10154)
 (floats 8 36 182)
 (intervals 56 266 0)
 (buffers 1000 14))

-- 
Rock on! -Muto
https://muto.ca