Switching accounts

2 views
Skip to first unread message

Norm Tovey-Walsh

unread,
May 17, 2024, 6:43:03 AMMay 17
to mu-di...@googlegroups.com
Hi,

I feel like I should be able to figure this out, or find other discussion of it in the archives, but I’ve been unsuccessful.

I recently upgraded from 1.10.x to 1.12.5. I’ve noticed that when I switch accounts, my email address is no longer updated. (I want no...@work.domain for work messages, n...@nwalsh.com for non-work ones, etc.)

This is the function that I add as an mu4e-compose-pre-hook, but it no longer works, and the Multiple-accounts.html page no longer exists :-(

Is my error obvious?

(defun my-mu4e-set-account ()
"Set the account for composing a message.
This function is taken from:
https://www.djcbsoftware.nl/code/mu/mu4e/Multiple-accounts.html"
(let* ((account
(cond
(mu4e-compose-parent-message
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
(string-match "/\\(.*?\\)/" maildir)
(match-string 1 maildir)))
((mu4e-context-current)
(mu4e-context-name (mu4e-context-current)))
(t
(completing-read (format "Compose with account: (%s) "
(mapconcat #'(lambda (var) (car var))
my-mu4e-account-alist "/"))
(mapcar #'(lambda (var) (car var)) my-mu4e-account-alist)
nil t nil nil (caar my-mu4e-account-alist)))))
(account-vars (cdr (assoc account my-mu4e-account-alist))))
(if account-vars
(mapc #'(lambda (var)
(set (car var) (cadr var)))
account-vars)
(error (concat "No email account found: " account)))))

The my-mu4e-account-alist might have been part of the original solution, or I might have added it. It’s something like this:

(defvar my-mu4e-account-alist
'(("Personal"
(mu4e-sent-folder "/Personal/Sent")
(mu4e-drafts-folder "/Personal/Drafts")
(user-mail-address "n...@nwalsh.com")
)
("Work"
(mu4e-sent-folder "/Work/Sent")
(mu4e-drafts-folder "/Work/Drafts")
(user-mail-address "no...@work.domain")
)

))

Be seeing you,
norm

--
Norm Tovey-Walsh <n...@nwalsh.com>
https://norm.tovey-walsh.com/

> There is only one difference between a madman and me. I am not
> mad.--Salvador Dali
signature.asc

Charles-H. Schulz

unread,
May 17, 2024, 3:46:32 PMMay 17
to mu-di...@googlegroups.com
Hello Norm,

I filed this bug report yesterday: https://github.com/djcb/mu/issues/2708
While I do not use contexts to handle multiple accounts i have exactly the same problem. The implementation of the new message mode seems to be the root cause. Having said that the Gnus message integration does have its own benefits : https://www.gnu.org/software/emacs/manual/html_mono/message.html
Feel free to follow the issue.

All the best,

Charles.

--
You received this message because you are subscribed to the Google Groups "mu-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mu-discuss+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mu-discuss/m2le48u3bj.fsf%40nwalsh.com.

Dirk-Jan C. Binnema

unread,
May 17, 2024, 5:41:43 PMMay 17
to mu-di...@googlegroups.com
On Friday May 17 2024, Norm Tovey-Walsh wrote:

> Hi,
>
> I feel like I should be able to figure this out, or find other discussion of it in the archives, but I’ve been unsuccessful.
>
> I recently upgraded from 1.10.x to 1.12.5. I’ve noticed that when I switch accounts, my email address is no longer updated. (I want no...@work.domain for work messages, n...@nwalsh.com for non-work ones, etc.)
>
> This is the function that I add as an mu4e-compose-pre-hook, but it no longer works, and the Multiple-accounts.html page no longer exists :-(
>
> Is my error obvious?

I'd recommend using contexts instead;
"(mu4e) Contexts"
or
https://www.djcbsoftware.nl/code/mu/mu4e/Contexts.html

That said, things work a little different with the new composer and I
think I know what was missing; I've pushed some changes.

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036

Norm Tovey-Walsh

unread,
May 21, 2024, 4:56:47 AMMay 21
to mu-di...@googlegroups.com
> I'd recommend using contexts instead;
> "(mu4e) Contexts"
> or
> https://www.djcbsoftware.nl/code/mu/mu4e/Contexts.html
>
> That said, things work a little different with the new composer and I
> think I know what was missing; I've pushed some changes.

I was already using contexts, but I wasn’t setting the user-mail-address that way (for reasons unknown, probably ignorance).
That’s fixed my problem.

I did toy with the idea of building a new mu with your patches from a few days ago. I got to the point of doing the install and couldn’t figure out what it was going to do.

I’d like a hint about what ‘sudo make install’ is actually going to *do* before I pull the trigger. If meson has an equivalent of ‘make -n’, I didn’t find it in five minutes of searching…

Be seeing you,
norm

--
Norm Tovey-Walsh <n...@nwalsh.com>
https://norm.tovey-walsh.com/

> Beware of him that is slow to anger; for when it is long coming, it is
> the stronger when it comes, and the longer kept. Abused patience turns
> to fury.--Francis Quarles
signature.asc

Dirk-Jan C. Binnema

unread,
May 21, 2024, 7:08:21 AMMay 21
to mu-di...@googlegroups.com
On Tuesday May 21 2024, Norm Tovey-Walsh wrote:

>> I'd recommend using contexts instead;
>> "(mu4e) Contexts"
>> or
>> https://www.djcbsoftware.nl/code/mu/mu4e/Contexts.html
>>
>> That said, things work a little different with the new composer and I
>> think I know what was missing; I've pushed some changes.
>
> I was already using contexts, but I wasn’t setting the
> user-mail-address that way (for reasons unknown, probably ignorance).
> That’s fixed my problem.

> I did toy with the idea of building a new mu with your patches from a
> few days ago. I got to the point of doing the install and couldn’t
> figure out what it was going to do.

Yeah, or wait until 1.12.6.

> I’d like a hint about what ‘sudo make install’ is actually going to
> *do* before I pull the trigger. If meson has an equivalent of
> ‘make -n’, I didn’t find it in five minutes of searching…

`meson help install` :-)

Meson >= 0.57 has 'meson install' has '-n' / '--dry-run'.

Norm Tovey-Walsh

unread,
May 21, 2024, 7:26:36 AMMay 21
to mu-di...@googlegroups.com
> `meson help install` :-)

Okay, but *frustratingly* not any of these:

man meson
meson --help
meson --help install

:-/

(I mean, that’s obviously not your fault, I’m just saying. And I did say that I didn’t find it in five minutes ;-) )

Be seeing you,
norm

--
Norm Tovey-Walsh <n...@nwalsh.com>
https://norm.tovey-walsh.com/

> "Abstraction, abstraction and abstraction." This is the answer to the
> question, "What are the three most important words in
> programming?"--Paul Hudak
signature.asc
Reply all
Reply to author
Forward
0 new messages