Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: info-gnus-english@gnu.org
Subject: Re: Opening pdf files in Acroread
Date: Wed, 17 Feb 2010 15:39:06 +0100	[thread overview]
Message-ID: <87tytgc4fp.fsf@tux.homenetwork> (raw)
In-Reply-To: <87tytgca1l.fsf@mean.albasani.net>

Memnon Anon <gegendosenfleisch@googlemail.com> writes:

> Cecil Westerhof <Cecil@decebal.nl> writes:
>> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>>> Not sure from where you try to open file, but adding a line like this in
>>> your ~/.mailcap should help:
>>>
>>> ,----[ mailcap entry ]
>>> | application/pdf; acroread %s
>>> `----
>> That file was not on my system. The file /etc/mailcap was, but had no
>> entry for pdf. I made the .mailcap file with the named entry, but to no
>> avail.
>
> Hi,
>
> I have this (Debian Testing)
>
> ,----[ /etc/mailcap ]
> | application/pdf; /usr/bin/xpdf '%s'; test=test "$DISPLAY" != ""; description=Portable Document Format; nametemplate=%s.pdf
> | application/x-pdf; /usr/bin/xpdf '%s'; test=test "$DISPLAY" != ""; description=Portable Document Format; nametemplate=%s.pdf
> `----
>
> Pressing 'e' on an attached pdf opens xpdf for me.
>
> What does "C-h v mailcap-mime-data" give for you?
> Here is my relevant output:
>
> Value: 
> (("application"
>   ("vnd\\.oasis\\.opendocument\\.database"
>
> [...]
>
>   ("pdf"
>    (viewer . "/usr/bin/xpdf '%s'")
>    (type . "application/pdf")
>    ("nametemplate" . "%s.pdf")
>    ("description" . "Portable Document Format")
>    (test . "test \"$DISPLAY\" != \"\""))
>   ("x-pdf"
>    (viewer . "/usr/bin/xpdf '%s'")
>    (type . "application/x-pdf")
>    ("nametemplate" . "%s.pdf")
>    ("description" . "Portable Document Format")
>    (test "test" "\"$DISPLAY\"" "!=" "\"\""))
>   ("pdf"
>    (viewer . "fbgs -c '%s'")
>    (type . "application/pdf")
>    ("needsterminal" . t)
>    (test))
>
> [...]
>
> hth

This little function will give you the command used by mailcap for a
given file:

(defun get-mailcap-for-file (filename)
  "Get the command to use for FILENAME from mailcap file.
The command is like <command %s> and is meant to use with `format'."
  (let* ((ext  (file-name-extension filename))
         (mime (when ext (mailcap-extension-to-mime ext))))
    (when mime (mailcap-mime-info mime))))

(get-mailcap-for-file "foo.pdf")
==> "xpdf %s"

-- 
Thierry Volpiatto

  reply	other threads:[~2010-02-17 14:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-14 22:15 Cecil Westerhof
2010-02-15  7:53 ` Thierry Volpiatto
     [not found] ` <mailman.1266.1266220709.14305.info-gnus-english@gnu.org>
2010-02-17 11:22   ` Cecil Westerhof
2010-02-17 12:01     ` Cecil Westerhof
2010-02-17 13:02     ` Memnon Anon
2010-02-17 14:39       ` Thierry Volpiatto [this message]
2010-04-17 18:20     ` Slackrat

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=87tytgc4fp.fsf@tux.homenetwork \
    --to=thierry.volpiatto@gmail.com \
    --cc=info-gnus-english@gnu.org \
    /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.
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).