Allow content preference based on message content.

An example configuration might be:

  (defun dme:determine-discouraged (msg)
    (let* ((headers (plist-get msg :headers))
           (from (or (plist-get headers :From) "")))
      (cond
       ((string-match "[email protected]" from)
        '("text/plain"))
       (t
        '("text/html" "multipart/related")))))

  (setq notmuch-multipart/alternative-discouraged
        'dme:determine-discouraged)

This would discourage text/html and multipart/related generally, but
discourage text/plain should the message be sent from
[email protected].

v2:
- Remove the simple evaluation variant based on feedback.

v3:
- Merge forward.
- Update the example to allow for a nil msg (which should no longer
  happen, but it's good to be safe).


David Edmondson (1):
  emacs: Allow part preferences to depend on message content.

 emacs/notmuch-lib.el  | 20 ++++++++++++++++----
 emacs/notmuch-show.el |  2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)

-- 
2.1.4

_______________________________________________
notmuch mailing list
[email protected]
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to