[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Opening pdf files in Acroread
From: |
Thierry Volpiatto |
Subject: |
Re: Opening pdf files in Acroread |
Date: |
Wed, 17 Feb 2010 15:39:06 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.92 (gnu/linux) |
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