[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23184: 25.0.92; User-friendly way to override doc-view-mode as MIME

From: Tassilo Horn
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux)

Teemu Likonen <address@hidden> 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

> 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

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?)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]