I wanted to open a pdf at a particular page, the instructions under org-file-apps suggested using
(add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . "evince -p %1 %s"))
This doesn't work because the regular _expression_ doesn't parse the link but the path. Therefore the ::(\d+) part is not being matched.
I had to write my own version using both file and link but maybe there is a better way -- or a more elegant solution than what I have below. Please let me know.
(add-to-list 'org-file-apps
'("\\.pdf\\'" .
(lambda
(file link)
(let*
((mylink
(split-string link "::"))
(option
(>
(length mylink)
1))
(cmd
(concat "evince " file
(and option
(concat " -p "
(nth 1 mylink))))))
(message "Running %s...done" cmd)
(start-process-shell-command cmd nil cmd)))))