3

I use an org file called books.org to store all the information about my books, including the location of the files (.pdf or .djvu). Usually I open these files directly from Emacs by pressing C-c o. This works like a charm with .pdf which are opened in Evince because I added this lines in my .emacs:

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

but not with .djvu which are not opened even if Evince can handle both filetypes. Do you know how I can tell to Emacs to use Evince to open these files?

  • Is it possible to provide a minimal working example of your org file? Maybe that helps for giving an answer. – Name Dec 13 '15 at 7:34
  • Do you think it is useful? Basically it is just an org link to a file. – falematte Dec 13 '15 at 10:27
4

I use this construction in my .emacs init-file (for djvu I prefer Okular, but you may use Evince as well):

;; Files association
(setq org-file-apps
    '((auto-mode . emacs)
    ("\\.x?html?\\'" . "firefox %s")
    ("\\.odp\\'" . "libreoffice \"%s\"")
    ("\\.doc\\'" . "libreoffice \"%s\"")
    ("\\.pdf\\'" . "okular \"%s\"")
    ("\\.pdf::\\([0-9]+\\)\\'" . "okular \"%s\" -p %1")
    ("\\.djvu\\'" . "okular \"%s\"")
    ("\\.djvu::\\([0-9]+\\)\\'" . "okular \"%s\" -p %1")))

And after that I may use links to file:

file:/data/file.djvu

Оr link to page of file:

file:/data/file.djvu::90
  • I would suggest to improve the answer by removing the part of the code not directly related with the question. – falematte Dec 20 '15 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.