A typical message s-expression looks something like the following:
(:docid 32461 :from (("Nikola Tesla" . "firstname.lastname@example.org")) :to (("Thomas Edison" . "email@example.com")) :cc (("Rupert The Monkey" . "firstname.lastname@example.org")) :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) :parts ( (:index 1 :mime-type "text/plain" :size 12345 :attachment nil) (:index 2 :name "photo.jpg" :mime-type "image/jpeg" :size 147331 :attachment t) (:index 3 :name "book.pdf" :mime-type "application/pdf" :size 192220 :attachment t)) :references ("C8384574032D81EE81AF0114E4E74@123213.mail.example.com" "38203498230942D81EE81AF0114E4E74@123213.mail.example.com") :in-reply-to "38203498230942D81EE81AF0114E4E74@123213.mail.example.com" :body-txt "Hi Tom, .... ")
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:
(name . email), where name can be nil.
emacsuses (for example in
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
We start this sequence when mu4e is invoked (when the program is started). It calls mu4e-proc-ping, and registers a (lambda) function for mu4e-proc-pong-func, to handle the response.
-> cmd:ping <- (pong "mu" :version "x.x.x" :doccount 10000)
When we receive such a pong (in mu4e-proc.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
emacs for internal purposes. Therefore, we need to split time_t in