On Mon,  6 Feb 2012 15:39:07 +0000, David Edmondson <[email protected]> wrote:
> Add a regexp, `notmuch-show-part-headers-hidden' and if the
> content-type of a part matches, don't show the part header.
> ---
>  emacs/notmuch-show.el |   43 ++++++++++++++++++++++++++++---------------
>  1 files changed, 28 insertions(+), 15 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 079d7cb..ce79762 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -125,6 +125,12 @@ indentation."
>                (const :tag "View interactively"
>                       notmuch-show-interactively-view-part)))
>  
> +(defcustom notmuch-show-part-headers-hidden nil
> +  "Headers for parts whose content-type matches this regexp will
> +not be shown."
> +  :group 'notmuch
> +  :type 'regexp)
> +

Hi 

I found this confusing for two reasons: first I thought the entire
content-type would have to match the regular expression but content-type
only needs to contain the regular expression. Secondly the value I typed
into the defcustom box seemed to need to be in quotes or I got an error
message.

Best wishes

Mark

>  (defmacro with-current-notmuch-show-message (&rest body)
>    "Evaluate body with current buffer set to the text of current message"
>    `(save-excursion
> @@ -397,24 +403,31 @@ message at DEPTH in the current thread."
>    "Submap for button commands")
>  (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
>  
> +(defun notmuch-show-hidden-part-header (content-type)
> +  "Return non-nil if a part header should be hidden for
> +CONTENT-TYPE parts."
> +  (and notmuch-show-part-headers-hidden
> +       (string-match notmuch-show-part-headers-hidden content-type)))
> +
>  (defun notmuch-show-insert-part-header (nth content-type declared-type
>                                           &optional name comment
>                                           &rest button-parameters)
> -  (apply #'insert-button
> -      (concat "[ "
> -              (if name (concat name ": ") "")
> -              declared-type
> -              (if (not (string-equal declared-type content-type))
> -                  (concat " (as " content-type ")")
> -                "")
> -              (or comment "")
> -              " ]")
> -      :type 'notmuch-show-part-button-type
> -      :notmuch-part nth
> -      :notmuch-filename name
> -      :notmuch-content-type content-type
> -      button-parameters)
> -  (insert "\n"))
> +  (unless (notmuch-show-hidden-part-header content-type)
> +    (apply #'insert-button
> +        (concat "[ "
> +                (if name (concat name ": ") "")
> +                declared-type
> +                (if (not (string-equal declared-type content-type))
> +                    (concat " (as " content-type ")")
> +                  "")
> +                (or comment "")
> +                " ]")
> +        :type 'notmuch-show-part-button-type
> +        :notmuch-part nth
> +        :notmuch-filename name
> +        :notmuch-content-type content-type
> +        button-parameters)
> +    (insert "\n")))
>  
>  ;; Functions handling particular MIME parts.
>  
> -- 
> 1.7.8.3
> 
> _______________________________________________
> notmuch mailing list
> [email protected]
> http://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[email protected]
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to