As a word of warning, the details of the s-expression are internal to the mu4e - mu communications, and are subject to change between versions.
A typical message s-expression looks something like the following:
(:docid 32461 :from ((:name "Nikola Tesla" :email "niko@example.com")) :to ((:name "Thomas Edison" :email "tom@example.com")) :cc ((:name "Rupert The Monkey" :email "rupert@example.com")) :subject "RE: what about the 50K?" :date (20369 17624 0) :size 4337 :message-id "C8233AB82D81EE81AF0114E4E74@123213.mail.example.com" :path "/home/tom/Maildir/INBOX/cur/133443243973_1.10027.atlas:2,S" :maildir "/INBOX" :priority normal :flags (seen attach) .... ")
This s-expression forms a property list (plist
), and we can get
values from it using plist-get
; for example (plist-get msg
:subject)
would get you the message subject. However, it’s better to
use the function mu4e-message-field
to shield you from some of
the implementation details that are subject to change; and see the other
convenience functions in mu4e-message.el.
Some notes on the format:
plists
of the form
(:name <name> :email <email>)
, where name
can be nil
.
current-time
).20
As an example of the communication between mu4e
and mu
,
let’s look at the ping-pong
-sequence. When mu4e
starts, it
sends a command ping
to the mu server
backend, to learn about
its version. mu server
then responds with a pong
s-expression
to provide this information (this is implemented in
mu-cmd-server.c).
We start this sequence when mu4e
is invoked (when the program is
started). It calls mu4e--server-ping
, and registers a (lambda)
function for mu4e-server-pong-func
, to handle the response.
-> (ping) <-<prefix>(:pong "mu" :props (:version "x.x.x" :doccount 78545))
When we receive such a pong
(in mu4e-server.el), the lambda
function we registered is called, and it compares the version we got
from the pong
with the version we expected, and raises an error if
they differ.
Emacs 32-bit integers have only 29 bits
available for the actual number; the other bits are use by Emacs for
internal purposes. Therefore, we need to split time_t
in two
numbers.