Prefilling fields when composing messages

11 views
Skip to first unread message

Evan Klitzke

unread,
Mar 26, 2018, 1:35:09 PM3/26/18
to mu-discuss
I want to write an elisp function that will create a mu4e-compose buffer
with the To: field prefilled with the word under the current point. I
was looking at mu4e-compose.el code and was a little lost at how to get
started, as I haven't really worked with message-mode before. Can
someone give me some pointers on where to get started?

--
Evan Klitzke pgp: 0x157EFCACBC648422
e: ev...@eklitzke.org w: https://eklitzke.org

Dirk-Jan C. Binnema

unread,
Mar 31, 2018, 6:59:45 AM3/31/18
to mu-di...@googlegroups.com

On Monday Mar 26 2018, Evan Klitzke wrote:

> I want to write an elisp function that will create a mu4e-compose
> buffer with the To: field prefilled with the word under the current
> point. I was looking at mu4e-compose.el code and was a little lost at
> how to get started, as I haven't really worked with message-mode
> before. Can someone give me some pointers on where to get started?

When you've set up mu4e as your emacs mail-agent, you can use
compose-mail. ie.
--8<---------------cut here---------------start------------->8---
(setq mail-user-agent 'mu4e-user-agent)
--8<---------------cut here---------------end--------------->8---

`compose-mail' looks like:
--8<---------------cut here---------------start------------->8---
(compose-mail &optional TO SUBJECT OTHER-HEADERS CONTINUE
SWITCH-FUNCTION YANK-ACTION SEND-ACTIONS RETURN-ACTION)
--8<---------------cut here---------------end--------------->8---

So basically:
--8<---------------cut here---------------start------------->8---
(compose-mail (thing-at-point 'word t))
--8<---------------cut here---------------end--------------->8---

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C
Reply all
Reply to author
Forward
0 new messages