unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* pdf viewer
@ 2018-10-06  9:02 Kamil Jońca
  2018-10-06  9:39 ` Teemu Likonen
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Kamil Jońca @ 2018-10-06  9:02 UTC (permalink / raw)
  To: help-gnu-emacs


For some time emacs view pdf files with its internal viewer.
But I want to keep old behavior - open them with xpdf/evince
How can I do it? I google some but without success.
KJ

-- 
http://stopstopnop.pl/stop_stopnop.pl_o_nas.html
"You're a creature of the night, Michael.  Wait'll Mom hears about this."
		-- from the movie "The Lost Boys"


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

* Re: pdf viewer
  2018-10-06  9:02 pdf viewer Kamil Jońca
@ 2018-10-06  9:39 ` Teemu Likonen
  2018-10-06 10:53   ` Garreau, Alexandre
       [not found]   ` <mailman.1753.1538823923.1284.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.1750.1538818772.1284.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Teemu Likonen @ 2018-10-06  9:39 UTC (permalink / raw)
  To: Kamil Jońca; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

Kamil Jońca [2018-10-06 11:02:54+02] wrote:

> For some time emacs view pdf files with its internal viewer. But I
> want to keep old behavior - open them with xpdf/evince How can I do
> it?

You can use mailcap-user-mime-data variable to override the (generated)
defaults in mailcap-mime-data:

    (setq mailcap-user-mime-data
          '(((type . "application/pdf")
             (viewer . "evince %s"))))

-- 
/// Teemu Likonen   - .-..   <https://keybase.io/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* Re: pdf viewer
       [not found] ` <mailman.1750.1538818772.1284.help-gnu-emacs@gnu.org>
@ 2018-10-06  9:51   ` Kamil Jońca
  2018-10-06 10:52     ` tomas
       [not found]     ` <mailman.1754.1538823926.1284.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 14+ messages in thread
From: Kamil Jońca @ 2018-10-06  9:51 UTC (permalink / raw)
  To: help-gnu-emacs

Teemu Likonen <tlikonen@iki.fi> writes:

> Kamil Jońca [2018-10-06 11:02:54+02] wrote:
>
>> For some time emacs view pdf files with its internal viewer. But I
>> want to keep old behavior - open them with xpdf/evince How can I do
>> it?
>
> You can use mailcap-user-mime-data variable to override the (generated)
> defaults in mailcap-mime-data:
>
>     (setq mailcap-user-mime-data
>           '(((type . "application/pdf")
>              (viewer . "evince %s"))))

It does not work. Still pdf is open by internal viewer :(
KJ

-- 
http://wolnelektury.pl/wesprzyj/teraz/
Hope is a waking dream.
		-- Aristotle


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

* Re: pdf viewer
  2018-10-06  9:51   ` Kamil Jońca
@ 2018-10-06 10:52     ` tomas
       [not found]     ` <mailman.1754.1538823926.1284.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: tomas @ 2018-10-06 10:52 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

On Sat, Oct 06, 2018 at 11:51:45AM +0200, Kamil Jońca wrote:
> Teemu Likonen <tlikonen@iki.fi> writes:
> 
> > Kamil Jońca [2018-10-06 11:02:54+02] wrote:
> >
> >> For some time emacs view pdf files with its internal viewer. But I
> >> want to keep old behavior - open them with xpdf/evince How can I do
> >> it?
> >
> > You can use mailcap-user-mime-data variable to override the (generated)
> > defaults in mailcap-mime-data:
> >
> >     (setq mailcap-user-mime-data
> >           '(((type . "application/pdf")
> >              (viewer . "evince %s"))))
> 
> It does not work. Still pdf is open by internal viewer :(
> KJ

Is this from org-mode? If yes, this snippet works for me:

     (setq org-file-apps
          (cons
           '("\\.pdf\\(?:::\\([0-9]*\\)\\)\\'" . "xpdf %s %1")
           (assoc-delete-all "\\.pdf\\'" org-file-apps)))

Otherwise you might want to have a look at doc-view-mode: I think
this is the one responsible for displaying the pdfs whithin Emacs.

Cheers
-- tomás

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: pdf viewer
  2018-10-06  9:39 ` Teemu Likonen
@ 2018-10-06 10:53   ` Garreau, Alexandre
       [not found]   ` <mailman.1753.1538823923.1284.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Garreau, Alexandre @ 2018-10-06 10:53 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: help-gnu-emacs, Kamil Jońca

On 2018-10-06 at 12:39, Teemu Likonen wrote:
> Kamil Jońca [2018-10-06 11:02:54+02] wrote:
>
>> For some time emacs view pdf files with its internal viewer. But I
>> want to keep old behavior - open them with xpdf/evince How can I do
>> it?
>
> You can use mailcap-user-mime-data variable to override the (generated)
> defaults in mailcap-mime-data:
>
>     (setq mailcap-user-mime-data
>           '(((type . "application/pdf")
>              (viewer . "evince %s"))))

My emacs uses its internal viewer doc view, and yet I see this in my
predefined (I didn’t touch it myself) mailcap-user-mime-data:

#+BEGIN_SRC elisp
  ("pdf"
   (viewer . "okular '%s'")
   (type . "application/pdf")
   (test "test" "\"$DISPLAY\"" "!=" "\"\"")
   ("nametemplate" . "%s.pdf"))
#+END_SRC

Also mine is huge, wouldn’t what you proposed erase it all? Wouldn’t
`add-to-list' be more appropriated?

#+BEGIN_SRC elisp
  (add-to-list 'mailcap-user-mime-data
               '((type . "application/pdf")
                 (viewer . "evince %s")))
#+END_SRC



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

* Re: pdf viewer
       [not found]     ` <mailman.1754.1538823926.1284.help-gnu-emacs@gnu.org>
@ 2018-10-06 11:12       ` Kamil Jońca
  0 siblings, 0 replies; 14+ messages in thread
From: Kamil Jońca @ 2018-10-06 11:12 UTC (permalink / raw)
  To: help-gnu-emacs

<tomas@tuxteam.de> writes:

> On Sat, Oct 06, 2018 at 11:51:45AM +0200, Kamil Jońca wrote:
> Is this from org-mode? If yes, this snippet works for me:

No, mainly from mails (gnus).

KJ

-- 
http://stopstopnop.pl/stop_stopnop.pl_o_nas.html
Store in a cool place.


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

* Re: pdf viewer
       [not found]   ` <mailman.1753.1538823923.1284.help-gnu-emacs@gnu.org>
@ 2018-10-06 11:14     ` Kamil Jońca
  2018-10-06 11:29       ` Garreau, Alexandre
                         ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Kamil Jońca @ 2018-10-06 11:14 UTC (permalink / raw)
  To: help-gnu-emacs

"Garreau, Alexandre" <galex-713@galex-713.eu> writes:

> On 2018-10-06 at 12:39, Teemu Likonen wrote:
>> Kamil Jońca [2018-10-06 11:02:54+02] wrote:
>>
>>> For some time emacs view pdf files with its internal viewer. But I
>>> want to keep old behavior - open them with xpdf/evince How can I do
>>> it?
>>
>> You can use mailcap-user-mime-data variable to override the (generated)
>> defaults in mailcap-mime-data:
>>
>>     (setq mailcap-user-mime-data
>>           '(((type . "application/pdf")
>>              (viewer . "evince %s"))))
>
> My emacs uses its internal viewer doc view, and yet I see this in my
> predefined (I didn’t touch it myself) mailcap-user-mime-data:
>
> #+BEGIN_SRC elisp
>   ("pdf"
>    (viewer . "okular '%s'")
>    (type . "application/pdf")
>    (test "test" "\"$DISPLAY\"" "!=" "\"\"")
>    ("nametemplate" . "%s.pdf"))
> #+END_SRC
>
Are you sure you speak about mailcap-user-mime-data, not
mailcap-mime-data?

I have huge mailcap-mime-data, but mailcap-user-mime-data was
empty/undefined.
KJ

-- 
http://stopstopnop.pl/stop_stopnop.pl_o_nas.html
A lie in time saves nine.


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

* Re: pdf viewer
  2018-10-06 11:14     ` Kamil Jońca
@ 2018-10-06 11:29       ` Garreau, Alexandre
  2018-10-06 13:22       ` Colin Baxter
  2018-10-07  0:12       ` Ben Bacarisse
  2 siblings, 0 replies; 14+ messages in thread
From: Garreau, Alexandre @ 2018-10-06 11:29 UTC (permalink / raw)
  To: Kamil Jońca; +Cc: help-gnu-emacs

On 2018-10-06 at 13:14, Kamil Jońca wrote:
> Are you sure you speak about mailcap-user-mime-data, not
> mailcap-mime-data?
>
> I have huge mailcap-mime-data, but mailcap-user-mime-data was
> empty/undefined.

You are indeed right, I confused both: as it was undefined C-h v didn’t
worked, and I didn’t realize auto-completion did show me another
variable. Sorry.



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

* Re: pdf viewer
  2018-10-06 11:14     ` Kamil Jońca
  2018-10-06 11:29       ` Garreau, Alexandre
@ 2018-10-06 13:22       ` Colin Baxter
  2018-10-07  0:12       ` Ben Bacarisse
  2 siblings, 0 replies; 14+ messages in thread
From: Colin Baxter @ 2018-10-06 13:22 UTC (permalink / raw)
  To: Kamil Jońca; +Cc: help-gnu-emacs

>>>>> Kamil Jońca <kjonca@poczta.onet.pl> writes:

    > "Garreau, Alexandre" <galex-713@galex-713.eu> writes:
    >> On 2018-10-06 at 12:39, Teemu Likonen wrote:
    >>> Kamil Jońca [2018-10-06 11:02:54+02] wrote:
    >>> 
    >>>> For some time emacs view pdf files with its internal
    >>>> viewer. But I want to keep old behavior - open them with
    >>>> xpdf/evince How can I do it?
    >>> 
    >>> You can use mailcap-user-mime-data variable to override the
    >>> (generated) defaults in mailcap-mime-data:
    >>> 
    >>> (setq mailcap-user-mime-data '(((type . "application/pdf")
    >>> (viewer . "evince %s"))))
    >> 
    >> My emacs uses its internal viewer doc view, and yet I see this in
    >> my predefined (I didn’t touch it myself) mailcap-user-mime-data:
    >> 
    >> #+BEGIN_SRC elisp ("pdf" (viewer . "okular '%s'") (type
    >> . "application/pdf") (test "test" "\"$DISPLAY\"" "!=" "\"\"")
    >> ("nametemplate" . "%s.pdf")) #+END_SRC
    >> 
    > Are you sure you speak about mailcap-user-mime-data, not
    > mailcap-mime-data?

    > I have huge mailcap-mime-data, but mailcap-user-mime-data was
    > empty/undefined.  KJ

    > -- http://stopstopnop.pl/stop_stopnop.pl_o_nas.html A lie in time
    > saves nine.


You can also use a hook. This works for me:

(add-hook 'org-mode-hook
           '(lambda ()
            (delete '("\\.pdf\\'" . default) org-file-apps)
	    (add-to-list 'org-file-apps '("\\.pdf\\'" . "xpdf %s"))))

Best wishes,
 
Colin Baxter
m43cap@yandex.com



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

* Re: pdf viewer
  2018-10-06  9:02 pdf viewer Kamil Jońca
  2018-10-06  9:39 ` Teemu Likonen
       [not found] ` <mailman.1750.1538818772.1284.help-gnu-emacs@gnu.org>
@ 2018-10-06 14:57 ` Marcin Borkowski
       [not found] ` <mailman.1762.1538837917.1284.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 14+ messages in thread
From: Marcin Borkowski @ 2018-10-06 14:57 UTC (permalink / raw)
  To: Kamil Jońca; +Cc: help-gnu-emacs


On 2018-10-06, at 11:02, Kamil Jońca <kjonca@poczta.onet.pl> wrote:

> For some time emacs view pdf files with its internal viewer.
> But I want to keep old behavior - open them with xpdf/evince
> How can I do it? I google some but without success.

While I understand you wanting not to use doc-view-mode, did you try
pdf-tools?  It replaced xpdf/evince for me almost completely.

Hth,

-- 
Marcin Borkowski
http://mbork.pl



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

* Re: pdf viewer
       [not found] ` <mailman.1762.1538837917.1284.help-gnu-emacs@gnu.org>
@ 2018-10-06 16:26   ` Kamil Jońca
  2018-10-06 17:38     ` Marcin Borkowski
  0 siblings, 1 reply; 14+ messages in thread
From: Kamil Jońca @ 2018-10-06 16:26 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski <mbork@mbork.pl> writes:

> On 2018-10-06, at 11:02, Kamil Jońca <kjonca@poczta.onet.pl> wrote:
>
>> For some time emacs view pdf files with its internal viewer.
>> But I want to keep old behavior - open them with xpdf/evince
>> How can I do it? I google some but without success.
>
> While I understand you wanting not to use doc-view-mode, did you try
> pdf-tools?  It replaced xpdf/evince for me almost completely.

Whatever. Primarily I want made emacs start external viever by default
:)
KJ

-- 
http://wolnelektury.pl/wesprzyj/teraz/
QOTD:
	Talent does what it can, genius what it must.
	I do what I get paid to do.


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

* Re: pdf viewer
  2018-10-06 16:26   ` Kamil Jońca
@ 2018-10-06 17:38     ` Marcin Borkowski
  0 siblings, 0 replies; 14+ messages in thread
From: Marcin Borkowski @ 2018-10-06 17:38 UTC (permalink / raw)
  To: Kamil Jońca; +Cc: help-gnu-emacs


On 2018-10-06, at 18:26, Kamil Jońca <kjonca@poczta.onet.pl> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> On 2018-10-06, at 11:02, Kamil Jońca <kjonca@poczta.onet.pl> wrote:
>>
>>> For some time emacs view pdf files with its internal viewer.
>>> But I want to keep old behavior - open them with xpdf/evince
>>> How can I do it? I google some but without success.
>>
>> While I understand you wanting not to use doc-view-mode, did you try
>> pdf-tools?  It replaced xpdf/evince for me almost completely.
>
> Whatever. Primarily I want made emacs start external viever by default

The point is, pdf-tools works within Emacs. :)

Best,

-- 
Marcin Borkowski
http://mbork.pl



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

* Re: pdf viewer
  2018-10-06 11:14     ` Kamil Jońca
  2018-10-06 11:29       ` Garreau, Alexandre
  2018-10-06 13:22       ` Colin Baxter
@ 2018-10-07  0:12       ` Ben Bacarisse
  2018-10-07 12:11         ` Michael Heerdegen
  2 siblings, 1 reply; 14+ messages in thread
From: Ben Bacarisse @ 2018-10-07  0:12 UTC (permalink / raw)
  To: help-gnu-emacs

kjonca@poczta.onet.pl (Kamil Jońca) writes:

> "Garreau, Alexandre" <galex-713@galex-713.eu> writes:
>
>> On 2018-10-06 at 12:39, Teemu Likonen wrote:
>>> Kamil Jońca [2018-10-06 11:02:54+02] wrote:
>>>
>>>> For some time emacs view pdf files with its internal viewer. But I
>>>> want to keep old behavior - open them with xpdf/evince How can I do
>>>> it?
>>>
>>> You can use mailcap-user-mime-data variable to override the (generated)
>>> defaults in mailcap-mime-data:
>>>
>>>     (setq mailcap-user-mime-data
>>>           '(((type . "application/pdf")
>>>              (viewer . "evince %s"))))
>>
>> My emacs uses its internal viewer doc view, and yet I see this in my
>> predefined (I didn’t touch it myself) mailcap-user-mime-data:
>>
>> #+BEGIN_SRC elisp
>>   ("pdf"
>>    (viewer . "okular '%s'")
>>    (type . "application/pdf")
>>    (test "test" "\"$DISPLAY\"" "!=" "\"\"")
>>    ("nametemplate" . "%s.pdf"))
>> #+END_SRC
>>
> Are you sure you speak about mailcap-user-mime-data, not
> mailcap-mime-data?

Part of the trouble is that mailcap.el defines a sort function that
favours symbols over strings.  As a result, no matter what viewer
command you have, 'doc-view-mode will win out.

I have used a temporary fix which is to have

(require 'mailcap)
(setq mailcap-mime-data nil)
(mailcap-parse-mailcaps nil t)

in .emacs.  This is a crude fix, but it works for the time being.

I started a thread about this a few days ago in comp.emacs and there
have been some other ideas along the line of code to pickout the
'doc-view-mode a-list entries.

-- 
Ben.


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

* Re: pdf viewer
  2018-10-07  0:12       ` Ben Bacarisse
@ 2018-10-07 12:11         ` Michael Heerdegen
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Heerdegen @ 2018-10-07 12:11 UTC (permalink / raw)
  To: Ben Bacarisse; +Cc: help-gnu-emacs

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> Part of the trouble is that mailcap.el defines a sort function that
> favours symbols over strings.  As a result, no matter what viewer
> command you have, 'doc-view-mode will win out.

If this is true, we should have a bug report about this problem.

There had been "bug#23184: 25.0.92; User-friendly way to override
doc-view-mode as MIME viewer", but it seems you say that didn't solve
the problem for you.

I also found commit 7e47d44da4b54c518c5e09b4f3d58dafdd43033d "Prefer
settings from ~/.mailcap over system and Emacs settings" from Lars from
six months ago, dunno if it is relevant.


Michael.



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

end of thread, other threads:[~2018-10-07 12:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-06  9:02 pdf viewer Kamil Jońca
2018-10-06  9:39 ` Teemu Likonen
2018-10-06 10:53   ` Garreau, Alexandre
     [not found]   ` <mailman.1753.1538823923.1284.help-gnu-emacs@gnu.org>
2018-10-06 11:14     ` Kamil Jońca
2018-10-06 11:29       ` Garreau, Alexandre
2018-10-06 13:22       ` Colin Baxter
2018-10-07  0:12       ` Ben Bacarisse
2018-10-07 12:11         ` Michael Heerdegen
     [not found] ` <mailman.1750.1538818772.1284.help-gnu-emacs@gnu.org>
2018-10-06  9:51   ` Kamil Jońca
2018-10-06 10:52     ` tomas
     [not found]     ` <mailman.1754.1538823926.1284.help-gnu-emacs@gnu.org>
2018-10-06 11:12       ` Kamil Jońca
2018-10-06 14:57 ` Marcin Borkowski
     [not found] ` <mailman.1762.1538837917.1284.help-gnu-emacs@gnu.org>
2018-10-06 16:26   ` Kamil Jońca
2018-10-06 17:38     ` Marcin Borkowski

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 read-only IMAP folder(s) and NNTP newsgroup(s).