In Org-mode when I try to open a link to a PDF file nothing happens. Also, when I do C-c C-e d to export as LaTeX and process to PDF and open the PDF is generated but not opened. How do I make Org-mode open PDF files in Evince?
I am using Org-mode 7.6 in GNU Emacs 23.3.1 and Evince 3.2.1 in Ubuntu 11.10.
Another possible construct that could work for this would be to use
eval-after-loadrather thanadd-hook. It will only set the values once on startup, you won’t have to worry about entries being added or not (unless you regularly reload org).Combine that with
setcdrand you can avoid having to delete from the list and then re-add, addifand you’ll ensure that you either add or change the value. The if is only needed for values that aren’t in the list by default, just to make sure you don’t end up with conflicts somewhere down the line.Edit for clarification
eval-after-loadonly evaluates the block when(require 'org)is called. If org is already loaded it will evaluate immediately (I mistakenly thought it ran each time a library was loaded, but it seems to be only the first time). The difference betweenadd-hookandeval-after-loadis explained here.Since
org-file-appsis adefcustomit won’t change the values if you set them before org is loaded, if you build the list from scratch (including default values as in your second (uglier) solution) you could simplysetqin your init.el and everything would work. It also means it won’t overwrite your changes.Adding
(if (assocto the PDF entry won’t hurt anything, it will simply ensure that if PDFs are ever removed from the defaultorg-file-appsthat it will still be added. The only solution that would not fail if PDFs were removed is your second one. The others all assume the entry exists in one form or another.