unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: show: stop display of appliaction/* parts
Date: Sun, 08 Jan 2017 19:44:36 +0200	[thread overview]
Message-ID: <m28tql30qj.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <m2a8b1vgti.fsf@guru.guru-group.fi>

On Sun, Jan 08 2017, Tomi Ollila <tomi.ollila@iki.fi> wrote:

> On Sat, Jan 07 2017, Mark Walters <markwalters1009@gmail.com> wrote:
>
>> Gnus seems to display application/zip and application/tar by
>> default. This doesn't seem desirable so we override it.
>>
>> We only override ifthe user has not customized
>> mm-inline-override-types themselves.
>> ---
>
> I suggest 2 things:
>
> 1) fix typos ;)
> 2) do it like this: 
> +	 (if (equal mm-inline-override-types
> +		    (car (get 'mm-inline-override-types 'standard-value)))

I tried to test the above in emacs *scratch* buffer, but cannot get
either of the formats work when variable is non-nil.
example tries

(defcustom a '(a b) "a")
(defcustom b (list "a" "b") "b")
(defcustom c (cons 1 nil) "c")

then

(equal a (car (get 'a 'standard-value))) C-j
nil

(equal (list a) (get 'a 'standard-value)) C-j
nil

same with b & c

with (defcustom n nil "n") the above work

According to defcustom documentation the expression of STANDARD
is also stored -- when evaluating (get 'var 'standard-value) the
output looks like it: for example (get 'c 'standard-value)
((cons 1 nil))

If the same happens when using the patch, then we need to look alternative
-- there might be something good, as customize knows when variable is
modified...

Tomi

>
> Tomas: you can also pick the full function definition from notmuch-show.el
> and write it to ~/.emacs.d/notmuch-config.el -- if you do this you
> have to remember to remove it whenever you're upgrading to notmuch 0.24(?)
>
> Tomi
>
>> This was mentioned on irc today and this might be a reasonable way of
>> doing this.
>>
>> It does mean that if a user adds, for example, image/* to
>> mm-inline-override-types then application/* will be displayed again.
>>
>> It also makes it slightly awkward to allow all types (eg setting
>> mm-inline-override-types to non/existent would do).
>>
>> Also I feel there ought to be a better way to tell if a variable has
>> been customized (or otherwise set), but I didn't find one.
>>
>> Best wishes
>>
>> Mark
>>
>>
>> emacs/notmuch-show.el | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
>> index 364004b..42734ac 100644
>> --- a/emacs/notmuch-show.el
>> +++ b/emacs/notmuch-show.el
>> @@ -1227,7 +1227,15 @@ matched."
>>    (interactive "sNotmuch show: \nP")
>>    (let ((buffer-name (generate-new-buffer-name
>>  		      (or buffer-name
>> -			  (concat "*notmuch-" thread-id "*")))))
>> +			  (concat "*notmuch-" thread-id "*"))))
>> +	;; We override mm-inline-override-types to stop appliacation/*
>> +	;; parts from being displayed unless the user has customized
>> +	;; it themselves.
>> +	(mm-inline-override-types
>> +	 (if (equal (list mm-inline-override-types)
>> +		    (get 'mm-inline-override-types 'standard-value))
>> +	     (cons "application/*" mm-inline-override-types)
>> +	   mm-inline-override-types)))
>>      (switch-to-buffer (get-buffer-create buffer-name))
>>      ;; No need to track undo information for this buffer.
>>      (setq buffer-undo-list t)
>> -- 
>> 2.1.4
>>
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> https://notmuchmail.org/mailman/listinfo/notmuch
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2017-01-08 17:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-07 21:25 [PATCH] emacs: show: stop display of appliaction/* parts Mark Walters
2017-01-07 23:12 ` Tomas Nordin
2017-01-08 12:22   ` David Bremner
2017-01-08 13:09 ` Tomi Ollila
2017-01-08 17:44   ` Tomi Ollila [this message]
2017-01-08 19:52     ` Tomas Nordin
2017-01-08 21:49       ` Tomi Ollila
2017-01-28  9:47         ` [PATCH v2] emacs: show: stop display of application/* parts Mark Walters
2017-02-12 22:53           ` Tomas Nordin
2017-02-13 14:33             ` David Bremner
2017-02-27  8:31               ` Mark Walters
2017-02-27  9:00                 ` Tomi Ollila
2017-02-27 20:36                 ` Tomas Nordin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m28tql30qj.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).