On Sat, Jul 30 2016, Charlie Allom wrote:

> Do you have an example for the elisp-challenged, on how to match more
> than one email address? I'm just starting out with emacs but this patch
> is just what I need :)

There are many ways. This is what I am using:

  (defun dme:determine-discouraged (msg)
    (let* ((headers (plist-get msg :headers))
           (from (or (plist-get headers :From) "")))
      (cond
       ((string-match (regexp-opt
                       '(
                         ;; Parmiter's parent mail: text/plain with HTML 
content.
                         "[email protected]"
                         ;; Oracle mobile reports: text/plain with useless 
content.
                         "TEMA Alerts"
                         ;; Charles Stanley: HTML only emails.
                         "[email protected]"
                         ;; HackerNews: nicer in HTML.
                         "[email protected]"
                         ;; MasterCard: no content in the text.
                         "[email protected]"
                         ))
                      from)
        '("text/plain"))
       (t
        '("text/html" "multipart/related" "text/x-beehive-notification")))))


> Regards,
>   Charlie.
>   
> On Sun, Apr 03 2016 at 05:04:37 pm, David Edmondson <[email protected]> wrote:
>
>> 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(-)
>
> -- 
_______________________________________________
notmuch mailing list
[email protected]
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to