X-Git-Url: https://git.cworth.org/git?p=notmuch-wiki;a=blobdiff_plain;f=emacstips.mdwn;h=58641771798bd3f61bb34bd8b6bf7613f4f8fb77;hp=909261cb7fd36a48a23626f48a68287e65c13901;hb=219490b75a85ca18d449168575a0c7538e71612e;hpb=1ba35d9cae3a847da67313d9f8cb4db5ed1f94bd diff --git a/emacstips.mdwn b/emacstips.mdwn index 909261c..5864177 100644 --- a/emacstips.mdwn +++ b/emacstips.mdwn @@ -664,12 +664,12 @@ See also the **Usage:** section in `gnus-alias.el`. ## Multiple identities (and more) with message-templ Another option for multiple identities is -[message-templ](http://pivot.cs.unb.ca/git?p=message-templ.git;a=summary) +[message-templ](http://git.tethera.net/message-templ.git) (also a available in marmalade). This provides roughly the same facilities as wanderlust's template facility. See -[example.emacs.el](http://pivot.cs.unb.ca/git?p=message-templ.git;a=blob;f=example.emacs.el;hb=HEAD) +[example.emacs.el](https://git.tethera.net/message-templ.git/tree/example.emacs.el) for some simple examples of usage. ## Resending (or bouncing) messages @@ -939,3 +939,31 @@ discussion](https://notmuchmail.org/pipermail/notmuch/2018/026414.html). The `notmuch-extract-thread-patches` and `notmuch-extract-message-patches` commands from the `elpa-mailscripts` package in Debian (and its derivatives) can do this for you. + +## Allow content preference based on message context + +The preference for which sub-part of a multipart/alternative part is shown is +globally set. For example, if you prefer showing the html version over the text +based, you can set: + + (setq notmuch-multipart/alternative-discouraged '("text/plain" "text/html")) + +However, sometimes you might want to adapt your preference depending on the +context. You can override the default settings on a per-message basis by +providing a function that has access to the message and which returns the +discouraged type list. For example: + + (defun my/determine-discouraged (msg) + (let* ((headers (plist-get msg :headers)) + (from (or (plist-get headers :From) ""))) + (cond + ((string-match "whatever@mail.address.com" from) + '("text/plain")) + (t + '("text/html" "multipart/related"))))) + + (setq notmuch-multipart/alternative-discouraged + 'my/determine-discouraged) + +This would discourage text/html and multipart/related generally, but discourage +text/plain should the message be sent from whatever@mail.address.com.