[PATCH v1] emacs: Allow part preferences to depend on message content.
Aaron Ecay
aaronecay at gmail.com
Tue Jan 19 05:41:34 PST 2016
Hi David,
2016ko urtarrilak 15an, David Edmondson-ek idatzi zuen:
>
> Currently the preference for which sub-part of a multipart/alternative
> part is shown is global. Allow to the user to override the settings on a
> per-message basis by providing two new options:
>
> - the ability to call a function that has access to the message to
> return the discouraged type list,
> - a simple evaluation environment to reduce the need for most users to
> write their own function.
>
> The original approach is retained as the default.
> ---
> emacs/notmuch-lib.el | 39 +++++++++++++++++++++++++++++++++++----
> emacs/notmuch-mua.el | 2 +-
> emacs/notmuch-show.el | 2 +-
> 3 files changed, 37 insertions(+), 6 deletions(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 89c01a5..2b9d108 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -520,11 +520,42 @@ This replaces spaces, percents, and double quotes in STR with
> "multipart/related"
> ))
>
> -(defun notmuch-multipart/alternative-choose (types)
> - "Return a list of preferred types from the given list of types"
> +(defun notmuch-multipart/alternative-determine-discouraged-1 (msg directive)
> + (let* ((headers (plist-get msg :headers))
> + ;; Headers that we make available:
> + (from (plist-get headers :From))
> + (subject (plist-get headers :Subject))
> + (to (plist-get headers :To))
> + (cc (plist-get headers :Cc)))
> +
> + (eval directive)))
This code is not compatible with lexical binding in emacs >= 24, which I
assume notmuch will eventually want to adopt. What’s so bad about
writing a function?
--
Aaron Ecay
More information about the notmuch
mailing list