0

A few years ago I started using Org-mode for taking notes on PDFs. I used one of the solutions in How do I make Org-mode open PDF files in Evince? to make Org-mode open PDF files in Evince; I used the following in my .emacs :

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

I've returned to my .org file ater a year or so. Most probably my org-mode updated (it's 8.2.10 now) and the solution above no longer works -- Emacs itself opens the PDFs. What should I do?

What's troubling me additionally is that literally the first example in the documentation for org-file-apps is

                 Example: ("pdf" . "evince %s")
                      to open PDFs with evince.

However, I tried

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

and it still does not work -- the PDF is opened in an Emacs buffer.

The value of org-file-apps is:

 (("pdf" . "evince %s")
  (auto-mode . emacs)
  ("\\.mm\\'" . default)
  ("\\.x?html?\\'" . default))

Evince is installed :-) I'm using Emacs 24.5.1 on an Ubuntu 16.04 LTS. What should I do?

Leszek Wroński
  • 269
  • 3
  • 4
  • 12
  • 1
    The original solution *should* still work. Your later attempts suffer from various defects (e.g. the pdf value in `org-file-apps` should read `("\\.pdf\\'" . "evince %s")` ), but whether it "works" or not depends on how you open the file: if you have a link in an org file pointing to the PDF and you click on the link, it *will* open in evince. With `C-x C-f` however, org is out of the picture: emacs is in charge and it uses Document View. – NickD Feb 13 '18 at 22:43
  • @Nick Thanks! Your remark about `C-x C-f` was very useful to me; I'm using a way of generating and opening links described here: https://lists.gnu.org/archive/html/auctex-devel/2012-10/msg00005.html which uses `find-file`. I decided to go with `openwith`, then (https://emacs.stackexchange.com/questions/3105/how-to-use-an-external-program-as-the-default-way-to-open-pdfs-from-emacs ). I have no idea about: 1) why the method I was using worked before, since it used `findfile`; 2) why you'd say using `("pdf" . "evince %s")` was defective (it's lifted straight from the docs). Thanks again! – Leszek Wroński Feb 14 '18 at 07:05
  • 1
    Look at the difference in the pattern. Try with a text file called "pdffile.txt" e.g. If I've got it right, org-open-at-point will try to open it with evince - not sure what will happen next :-) – NickD Feb 14 '18 at 12:36

0 Answers0