* gnus and mailcap
@ 2014-02-21 9:59 Vincent Bernat
2014-02-22 10:32 ` Vincent Bernat
0 siblings, 1 reply; 2+ messages in thread
From: Vincent Bernat @ 2014-02-21 9:59 UTC (permalink / raw)
To: ding
Hi!
/etc/mailcap is less and less useful on current distributions. It can be
just absent or be automatically generated with unwanted entries (for
example, opening PDF in Gimp). Nowaday, it seems that mailcap is
deprecated in favor of .desktop files.
I have tried the following snippet to teach mailcap in Gnus to use
xdg-open for everything:
#+begin_src lisp
(setq mailcap-mime-data '(("application" (".*"
(viewer . "xdg-open '%s'")))
("image" (".*"
(viewer . "xdg-open '%s'")))
("text" ("html"
(viewer . "xdg-open '%s'"))))
mailcap-parsed-p t)
#+end_src
However, there are some parts of Gnus expecting exact MIME
types. Moreover, it seems that some MIME types are expected to be
handled by mm-* functions.
The default mailcap-mime-data contains some unwanted entries. So, even
with an empty mailcap, this doesn't work as expected. A mailcap with
this content doesn't work either as Gnus doesn't handle wildcards when
parsing:
#+begin_example
*/*; xdg-open '%s'; test=test -n "$DISPLAY"
#+end_example
Does someone have a generic way to rely on xdg-open for most stuff?
--
panic("Attempted to kill the idle task!");
2.2.16 /usr/src/linux/kernel/exit.c
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gnus and mailcap
2014-02-21 9:59 gnus and mailcap Vincent Bernat
@ 2014-02-22 10:32 ` Vincent Bernat
0 siblings, 0 replies; 2+ messages in thread
From: Vincent Bernat @ 2014-02-22 10:32 UTC (permalink / raw)
To: ding
❦ 21 février 2014 10:59 CET, Vincent Bernat <bernat@luffy.cx> :
> However, there are some parts of Gnus expecting exact MIME
> types. Moreover, it seems that some MIME types are expected to be
> handled by mm-* functions.
>
> The default mailcap-mime-data contains some unwanted entries. So, even
> with an empty mailcap, this doesn't work as expected. A mailcap with
> this content doesn't work either as Gnus doesn't handle wildcards when
> parsing:
>
> #+begin_example
> */*; xdg-open '%s'; test=test -n "$DISPLAY"
> #+end_example
>
> Does someone have a generic way to rely on xdg-open for most stuff?
Currently, I am using this:
#+begin_src lisp
(require 'dash)
(mailcap-parse-mailcaps)
(setq mailcap-mime-data
(--map (cons (car it)
(--map (cons (car it)
(--map (let ((key (car it))
(value (cdr it)))
(if (and (eq key 'viewer)
(stringp value))
'(viewer . "xdg-open '%s'")
it))
(cdr it)))
(cdr it)))
mailcap-mime-data))
#+end_src
This is quite hacky but it does what I want.
--
Say what you mean, simply and directly.
- The Elements of Programming Style (Kernighan & Plauger)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-22 10:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-21 9:59 gnus and mailcap Vincent Bernat
2014-02-22 10:32 ` Vincent Bernat
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).