Next: , Up: Miscellaneous functionality   [Contents][Index]


4.1 Injecting messages into a Maildir directory

public-inbox allows you to follow lists through several mechanisms (see public-inbox). You may prefer different methods for different projects depending on things like how actively you are following the development and how high traffic the list is. For a project you maintain, perhaps you want to receive every message as regular mail. For a project you actively follow and occasionally contribute to, you may prefer to not clutter your local mail store and instead follow via read-only NNTP or IMAP in Gnus (which may or may not be your MUA). And for a project you’re new to or are digging into for a particular reason, HTTP via EWW may be all you need.

Depending on your mail setup, a problem with this approach is that it can be inconvenient to start participating in a thread that you aren’t reading in your regular MUA (e.g., if you use notmuch.el to read your regular mail but are following a project via NNTP in Gnus). In this case, you can use the command piem-inject-thread-into-maildir to move the thread’s messages into a local Maildir directory specified by the current inbox’s :maildir value in piem-inboxes, falling back to piem-maildir-directory. By default the command downloads the entire thread for the message ID associated with the current buffer. A prefix argument restricts the download to only the message.

After the messages are injected, each function in piem-after-mail-injection-functions is called with the message ID that was used to identify the thread. This can be used to pop to the message in your mail client. For example, Notmuch users may want something like this:

(defun my/notmuch-new-and-show (mid)
  (message "Running notmuch new")
  (call-process notmuch-command nil nil nil "new")
  (notmuch-show (concat "id:"  mid)))

(add-hook 'piem-after-mail-injection-functions
          #'my/notmuch-new-and-show)

To prevent duplicate messages from being written on subsequent calls to piem-inject-thread-into-maildir, you can set piem-mail-injection-skipif-predicate to a function that returns non-nil if a message ID is known and should be skipped. For Notmuch, piem-notmuch provides a function that works for this purpose, piem-notmuch-known-mid-p:

(setq piem-mail-injection-skipif-predicate
      #'piem-notmuch-known-mid-p)

Next: Copying public-inbox URLs, Up: Miscellaneous functionality   [Contents][Index]