GNU bug report logs - #23184
25.0.92; User-friendly way to override doc-view-mode as MIME viewer

Previous Next

Package: emacs;

Reported by: Teemu Likonen <tlikonen <at> iki.fi>

Date: Sat, 2 Apr 2016 07:50:02 UTC

Severity: wishlist

Found in version 25.0.92

Done: Tassilo Horn <tsdh <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 23184 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Teemu Likonen <tlikonen <at> iki.fi>
Cc: 23184 <at> debbugs.gnu.org
Subject: Re: bug#23184: 25.0.92;
 User-friendly way to override doc-view-mode as MIME viewer
Date: Fri, 08 Apr 2016 22:46:49 +0200
Teemu Likonen <tlikonen <at> iki.fi> writes:

Hi Teemu,

> Emacs has mailcap-mime-data variable which is used to decide how
> various contents are displayed. The variable is (or seems to be)
> bootstrapped from operating system's mailcap configuration but Emacs
> overrides some parts of it with (viewer . doc-view-mode) or (viewer
> . pdf-view-mode).

`pdf-view-mode' and `doc-view-mode' are standard entries in
`mailcap-mime-data', and entries from mailcap files are prepended to the
list.

> Not all users want to use doc-view-mode for displaying mime contents. I
> wish there was an easy way to not use doc-view-mode or to move its
> priority to the bottom of the viewer list.

Hm, for me, evince (from my ~/.mailcap) is before `pdf-view-mode' which
is in turn before `doc-view-mode' in mailcap-mime-data' but still
clicking on a PDF attachment in Gnus opens the file with PDF Tools
(`pdf-view-mode', which I like very much).  So it seems its (at least
not only) the order in `mailcap-mime-data' which defines which tool is
used.

Ok, `mailcap-mime-info' computes the viewer to be used.  It first
selects all whose test passes (which would include doc-view, pdf-view,
"evince", "okular" and what not), and then sorts them according to
`mailcap-viewer-lessp' returning the first viewer after sorting.

`mailcap-viewer-lessp' prefers viewers whose declared type contains no
wildcard, and it prefers Emacs viewers over external apps.

So, yes, if you don't like PDF Tools or DocView, it's pretty hard to get
rid of them.

(1) We could add a function `mailcap-remove-viewer' which essentially
    does what you do already.

(2) Or maybe we could add a customizable list `mailcap-user-mime-data'
    (better name welcome) which would override `mailcap-mime-data',
    i.e., if a viewer is specified there, then `mailcap-mime-data' with
    the heuristics around it won't even be consulted.

I guess the second approach is better as it lets users specify
preferences instead of disabling alternatives until the heuristics
select the preferred viewer.

Any better suggestions?  If not, I can do that.  (In case I'd implement
that, should that go only into master or emacs-25?)

Bye,
Tassilo




This bug report was last modified 9 years and 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.