Gnus development mailing list
 help / color / mirror / Atom feed
* Re: Recent Emacs doesn't respect my mailcap
       [not found]       ` <mailman.18712.1422322837.1147.help-gnu-emacs@gnu.org>
@ 2015-01-27  1:58         ` Lars Magne Ingebrigtsen
  2015-01-27  2:11           ` Rasmus
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2015-01-27  1:58 UTC (permalink / raw)
  To: Rasmus; +Cc: help-gnu-emacs, ding

Rasmus <rasmus@gmx.us> writes:

>> That's because mailcap.el sorts the candidates using
>> mailcap-viewer-lessp, which is hardcoded to prefer lisp-implemented
>> viewers.
>
> http://thread.gmane.org/gmane.emacs.gnus.general/85405
>
> I took his word for it, though.

Oh, sorry, forgot that bit...

I've looked at the code a bit more, and what it's doing now seems rather
odd.

I can't seem to get

(mailcap-mime-info "application/pdf")

to respect my ~/.mailcap file at all?  Is that a bug or is it supposed
to be that way?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-27  1:58         ` Recent Emacs doesn't respect my mailcap Lars Magne Ingebrigtsen
@ 2015-01-27  2:11           ` Rasmus
  2015-01-27  2:42             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Rasmus @ 2015-01-27  2:11 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: ding

Hi,

Lars Magne Ingebrigtsen <lmi@gnus.org> writes:

>>> That's because mailcap.el sorts the candidates using
>>> mailcap-viewer-lessp, which is hardcoded to prefer lisp-implemented
>>> viewers.
>>
>> http://thread.gmane.org/gmane.emacs.gnus.general/85405
> 
> I've looked at the code a bit more, and what it's doing now seems rather
> odd.

OK.  I haven't checked it yet.

> I can't seem to get
>
> (mailcap-mime-info "application/pdf")
>
> to respect my ~/.mailcap file at all?  

Nope.

I picks up evince, which is in my ~/.mailcap after I remove doc-view-mode:

(setcdr
   (assoc "application" mailcap-mime-data)
   (remove '("pdf"
             (viewer . doc-view-mode)
             (type . "application/pdf")
             (test eq window-system 'x))
           (cdr (assoc "application" mailcap-mime-data))))

> Is that a bug or is it supposed to be that way?

A bug, I hope!

Thanks,
Rasmus

-- 
Bang bang




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-27  2:11           ` Rasmus
@ 2015-01-27  2:42             ` Lars Ingebrigtsen
  2015-01-27  3:01               ` Eric Abrahamsen
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2015-01-27  2:42 UTC (permalink / raw)
  To: Rasmus; +Cc: ding

Rasmus <rasmus@gmx.us> writes:

>> Is that a bug or is it supposed to be that way?
>
> A bug, I hope!

It was just me putting a non-existent viewer into the ~/.mailcap file,
so it was filtered out again later.  So that bit works.

So the issue is really whether we should keep preferring Lisp-based
(internal) viewers over external ones, even though the user has
specified this in ~/.mailcap (or otherwise).

That way of sorting seems to have been in place since 1998.  But is it a
good idea?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-27  2:42             ` Lars Ingebrigtsen
@ 2015-01-27  3:01               ` Eric Abrahamsen
  2015-01-27  3:01                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Abrahamsen @ 2015-01-27  3:01 UTC (permalink / raw)
  To: ding

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>>> Is that a bug or is it supposed to be that way?
>>
>> A bug, I hope!
>
> It was just me putting a non-existent viewer into the ~/.mailcap file,
> so it was filtered out again later.  So that bit works.
>
> So the issue is really whether we should keep preferring Lisp-based
> (internal) viewers over external ones, even though the user has
> specified this in ~/.mailcap (or otherwise).
>
> That way of sorting seems to have been in place since 1998.  But is it a
> good idea?

In my use case, I've already told Gnus to view the PDF externally by
using `gnus-article-view-part-externally'. Given that, and the fact that
I've specified an external viewer in ~/.mailcap, it seems a little
perverse that I'm still stuck seeing it in Doc View. If I wanted to do
that, I could have just called `gnus-article-view-part'!




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-27  3:01               ` Eric Abrahamsen
@ 2015-01-27  3:01                 ` Lars Ingebrigtsen
  2015-01-27  3:59                   ` Eric Abrahamsen
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2015-01-27  3:01 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: ding

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> In my use case, I've already told Gnus to view the PDF externally by
> using `gnus-article-view-part-externally'. Given that, and the fact that
> I've specified an external viewer in ~/.mailcap, it seems a little
> perverse that I'm still stuck seeing it in Doc View. If I wanted to do
> that, I could have just called `gnus-article-view-part'!

That does sound like a bug.  Perhaps that command should filter out all
Lisp functions from `mailcap-mime-data'?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-27  3:01                 ` Lars Ingebrigtsen
@ 2015-01-27  3:59                   ` Eric Abrahamsen
  2015-01-27  4:47                     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Abrahamsen @ 2015-01-27  3:59 UTC (permalink / raw)
  To: ding

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> In my use case, I've already told Gnus to view the PDF externally by
>> using `gnus-article-view-part-externally'. Given that, and the fact that
>> I've specified an external viewer in ~/.mailcap, it seems a little
>> perverse that I'm still stuck seeing it in Doc View. If I wanted to do
>> that, I could have just called `gnus-article-view-part'!
>
> That does sound like a bug.  Perhaps that command should filter out all
> Lisp functions from `mailcap-mime-data'?

Or put ~/.mailcap stuff at the front of the list, or maybe just don't
re-sort mailcap-mime-data. I don't think anything fancy needs to be done
-- it should be enough just to *not* mess with mailcap-mime-data. At
least users will have an easier time figuring out what's happening.

Dunno, really.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-27  3:59                   ` Eric Abrahamsen
@ 2015-01-27  4:47                     ` Lars Ingebrigtsen
  2015-01-27  5:08                       ` Eric Abrahamsen
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2015-01-27  4:47 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: ding

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> In my use case, I've already told Gnus to view the PDF externally by
>>> using `gnus-article-view-part-externally'. Given that, and the fact that
>>> I've specified an external viewer in ~/.mailcap, it seems a little
>>> perverse that I'm still stuck seeing it in Doc View. If I wanted to do
>>> that, I could have just called `gnus-article-view-part'!
>>
>> That does sound like a bug.  Perhaps that command should filter out all
>> Lisp functions from `mailcap-mime-data'?
>
> Or put ~/.mailcap stuff at the front of the list, or maybe just don't
> re-sort mailcap-mime-data. I don't think anything fancy needs to be done
> -- it should be enough just to *not* mess with mailcap-mime-data.

The `-externally' command should work different from the other command,
shouldn't it?  Otherwise, what's the point of having two of these
commands?

This code is so old it's hard to remember what the rationale for all
this may have been.  Perhaps people used to have huge ~/.mailcap files
installed by other programs, and that meant that all the nice internal
Emacs commands for dealing with stuff never got called?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-27  4:47                     ` Lars Ingebrigtsen
@ 2015-01-27  5:08                       ` Eric Abrahamsen
  2015-01-28  1:54                         ` Dave Goldberg
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Abrahamsen @ 2015-01-27  5:08 UTC (permalink / raw)
  To: ding

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Lars Ingebrigtsen <larsi@gnus.org> writes:
>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>
>>>> In my use case, I've already told Gnus to view the PDF externally by
>>>> using `gnus-article-view-part-externally'. Given that, and the fact that
>>>> I've specified an external viewer in ~/.mailcap, it seems a little
>>>> perverse that I'm still stuck seeing it in Doc View. If I wanted to do
>>>> that, I could have just called `gnus-article-view-part'!
>>>
>>> That does sound like a bug.  Perhaps that command should filter out all
>>> Lisp functions from `mailcap-mime-data'?
>>
>> Or put ~/.mailcap stuff at the front of the list, or maybe just don't
>> re-sort mailcap-mime-data. I don't think anything fancy needs to be done
>> -- it should be enough just to *not* mess with mailcap-mime-data.
>
> The `-externally' command should work different from the other command,
> shouldn't it?  Otherwise, what's the point of having two of these
> commands?

Good point!

> This code is so old it's hard to remember what the rationale for all
> this may have been.  Perhaps people used to have huge ~/.mailcap files
> installed by other programs, and that meant that all the nice internal
> Emacs commands for dealing with stuff never got called?

I really have no idea. Also, how does this interact with xdg/mimeapps
stuff? For handling external applications, I basically tell Emacs to
always use xdg-open, and then do the actual configuration in
~/.config/mimeapps.list, that way I'm using the same applications
system-wide.

But I think you're right, this code is probably tuned to the desktop as
it existed a decade ago...




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-27  5:08                       ` Eric Abrahamsen
@ 2015-01-28  1:54                         ` Dave Goldberg
  2015-01-29  2:21                           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Goldberg @ 2015-01-28  1:54 UTC (permalink / raw)
  To: ding

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> Lars Ingebrigtsen <larsi@gnus.org> writes:
>>>
>>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>>
>>>>> In my use case, I've already told Gnus to view the PDF externally by
>>>>> using `gnus-article-view-part-externally'. Given that, and the fact that
>>>>> I've specified an external viewer in ~/.mailcap, it seems a little
>>>>> perverse that I'm still stuck seeing it in Doc View. If I wanted to do
>>>>> that, I could have just called `gnus-article-view-part'!
>>>>
>>>> That does sound like a bug.  Perhaps that command should filter out all
>>>> Lisp functions from `mailcap-mime-data'?
>>>
>>> Or put ~/.mailcap stuff at the front of the list, or maybe just don't
>>> re-sort mailcap-mime-data. I don't think anything fancy needs to be done
>>> -- it should be enough just to *not* mess with mailcap-mime-data.
>>
>> The `-externally' command should work different from the other command,
>> shouldn't it?  Otherwise, what's the point of having two of these
>> commands?
>
> Good point!
>

So I've been silently grumbling about this issue for a couple months, but I've just gotten used to calling ...-view-part-interactively (from the context menu) and running acrobat reader.  docview is really not an option at work (where most of my PDF dealings come from) since my company uses some of the more irritating PDF features like digital signatures.  Whether that's done via view-part or view-part-externally (assuming there's a strong desire to have view-part favor an internal function) doesn't bother me but it would be nice if view-part-externally did what I told it to do.

Thanks,
-- 
Dave Goldberg
david.goldberg6@verizon.net



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Recent Emacs doesn't respect my mailcap
  2015-01-28  1:54                         ` Dave Goldberg
@ 2015-01-29  2:21                           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2015-01-29  2:21 UTC (permalink / raw)
  To: Dave Goldberg; +Cc: ding

david.goldberg6@verizon.net (Dave Goldberg) writes:

> So I've been silently grumbling about this issue for a couple months,
> but I've just gotten used to calling ...-view-part-interactively (from
> the context menu) and running acrobat reader.  docview is really not
> an option at work (where most of my PDF dealings come from) since my
> company uses some of the more irritating PDF features like digital
> signatures.  Whether that's done via view-part or view-part-externally
> (assuming there's a strong desire to have view-part favor an internal
> function) doesn't bother me but it would be nice if
> view-part-externally did what I told it to do.

Indeed.  I don't understand this function at all.

So, it gets the method from `(mailcap-mime-info type)', which has this
default in most Emacsen:

(mailcap-mime-info "application/pdf")
=> doc-view-mode

And that's obviously not a string, so it calls
`gnus-mime-view-part-as-type' with a nil type, so you get prompted for a
type?

But if it does return a string, then `mm-display-part' is called with
the default handling method?  (So we get an external viewer.)

Err...  Am I totally misreading this, or is it kinda nonsensical?

(defun gnus-mime-view-part-externally (&optional handle)
  "View the MIME part under point with an external viewer."
  (interactive)
  (gnus-article-check-buffer)
  (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
	 (mm-inlined-types nil)
	 (mail-parse-charset gnus-newsgroup-charset)
	 (mail-parse-ignored-charsets
          (with-current-buffer gnus-summary-buffer
            gnus-newsgroup-ignored-charsets))
         (type (mm-handle-media-type handle))
         (method (mailcap-mime-info type))
         (mm-enable-external t))
    (if (not (stringp method))
	(gnus-mime-view-part-as-type
	 nil (lambda (type) (stringp (mailcap-mime-info type))))
      (when handle
	(mm-display-part handle nil t)))))


-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-01-29  2:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.18666.1422291069.1147.help-gnu-emacs@gnu.org>
     [not found] ` <87386xf5gx.fsf@building.gnus.org>
     [not found]   ` <mailman.18710.1422322318.1147.help-gnu-emacs@gnu.org>
     [not found]     ` <87386xdmzp.fsf@building.gnus.org>
     [not found]       ` <mailman.18712.1422322837.1147.help-gnu-emacs@gnu.org>
2015-01-27  1:58         ` Recent Emacs doesn't respect my mailcap Lars Magne Ingebrigtsen
2015-01-27  2:11           ` Rasmus
2015-01-27  2:42             ` Lars Ingebrigtsen
2015-01-27  3:01               ` Eric Abrahamsen
2015-01-27  3:01                 ` Lars Ingebrigtsen
2015-01-27  3:59                   ` Eric Abrahamsen
2015-01-27  4:47                     ` Lars Ingebrigtsen
2015-01-27  5:08                       ` Eric Abrahamsen
2015-01-28  1:54                         ` Dave Goldberg
2015-01-29  2:21                           ` Lars Ingebrigtsen

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 NNTP newsgroup(s).