all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Teemu Likonen <tlikonen@iki.fi>
Cc: 23184@debbugs.gnu.org
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	[thread overview]
Message-ID: <878u0nj0au.fsf@gnu.org> (raw)
In-Reply-To: <87shz4pi13.fsf@iki.fi> (Teemu Likonen's message of "Sat, 02 Apr 2016 10:49:12 +0300")

Teemu Likonen <tlikonen@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





  reply	other threads:[~2016-04-08 20:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-02  7:49 bug#23184: 25.0.92; User-friendly way to override doc-view-mode as MIME viewer Teemu Likonen
2016-04-08 20:46 ` Tassilo Horn [this message]
2016-04-09  6:41   ` Eli Zaretskii
2016-04-09  8:57     ` Tassilo Horn
2016-04-09  9:27   ` Teemu Likonen
2016-04-09  9:47     ` Eli Zaretskii
2016-04-09 10:21       ` Tassilo Horn
2016-04-10 16:59         ` Tassilo Horn
2016-04-11 16:05           ` Michael Heerdegen
2016-04-11 16:12             ` Teemu Likonen
2016-04-11 17:16             ` Tassilo Horn
2016-04-11 19:09               ` Michael Heerdegen

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

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

  git send-email \
    --in-reply-to=878u0nj0au.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=23184@debbugs.gnu.org \
    --cc=tlikonen@iki.fi \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.