Previous: , Up: How it works   [Contents]

E.4 The message s-expression

A typical message s-expression looks something like the following:

(:docid 32461
 :from (("Nikola Tesla" . ""))
 :to (("Thomas Edison" . ""))
 :cc (("Rupert The Monkey" . ""))
 :subject "RE: what about the 50K?"
 :date (20369 17624 0)
 :size 4337
 :message-id ""
 :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  (""
 :in-reply-to ""
 :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:

E.4.1 Example: ping-pong

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-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 use by emacs for internal purposes. Therefore, we need to split time_t in two numbers.

Previous: , Up: How it works   [Contents]