contexts config in mu4e 1.12.12, emacs 30.1

15 views
Skip to first unread message

Ross McDonald

unread,
Aug 25, 2025, 4:41:09 PMAug 25
to mu-discuss
Hi all.

I'm struggling to get contexts configured successfully - have tried sample code from a pretty large number of examples online.

Specifically I'm trying to change context in the home screen but every time I try I get the message 'No contexts defined'.

Can anyone point the way to a bit of minimalist config that works for them?

Thanks!

Jorge Javier Araya Navarro

unread,
Aug 25, 2025, 4:46:02 PMAug 25
to mu-di...@googlegroups.com
Can you share (here or using Github Gist) what you have so far?

I personally use this macro:

--8<---------------cut here---------------start------------->8---
(cl-defmacro shackra/mu4e-easy-context (&key c-name maildir mail
smtp
(sent-action 'sent)
(name "Jorge Javier
Araya Navarro")
(sig
message-signature))
(let
((inbox (concat "/" maildir "/Inbox"))
(sent (concat "/" maildir "/Sent"))
(trash (concat "/" maildir "/Trash"))
(refile (concat "/" maildir "/Archive"))
(draft (concat "/" maildir "/Drafts")))

`(make-mu4e-context
:name ,c-name
:match-func (lambda (msg)
(when msg
(string-match-p (concat "^/" ,maildir "/")
(mu4e-message-field msg
:maildir))))
:vars '((user-mail-address . ,mail)
(user-full-name . ,name)
(mu4e-sent-folder . ,sent)
(mu4e-drafts-folder . ,draft)
(mu4e-trash-folder . ,trash)
(mu4e-refile-folder . ,refile)
(mu4e-compose-signature . (concat
,sig))
(mu4e-sent-messages-behavior .
,sent-action)
(message-signature . ,sig)
(mu4e-maildir-shortcuts .
((,inbox . ?i)
(,sent . ?s)
(,trash . ?t)
(,refile . ?a)
(,draft .
?d)))))))
--8<---------------cut here---------------end--------------->8---

and then:

--8<---------------cut here---------------start------------->8---
(setq mu4e-contexts `(,(shackra/mu4e-easy-context
:c-name "personal"
:maildir "principal"
:mail "jo...@esavara.cr")
,(shackra/mu4e-easy-context
:c-name "gmail"
:maildir "gmail"
:mail "shackra...@gmail.com"
:sent-action delete)
,(shackra/mu4e-easy-context
:c-name "yahoo"
:maildir "yahoo"
:mail "jorgej...@yahoo.com.mx")
,(shackra/mu4e-easy-context
:c-name "jorgearaya.dev"
:maildir "hey"
:mail "h...@jorgearaya.dev"
:sig "Jorge Araya\nFreelance Software
Engineer — https://jorgearaya.dev"
:sent-action delete)))
--8<---------------cut here---------------end--------------->8---
--
Jorge Araya

Contacto:
Telegram: t.me/shackra · Signal: Shackra.28
Reply all
Reply to author
Forward
0 new messages