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\\'" .
                           (file link)
                                 (split-string link "::"))
                                  (length mylink)
                                 (concat "evince " file
                                         (and option
                                              (concat " -p "
                                                      (nth 1 mylink))))))
                             (message "Running %s...done" cmd)
                             (start-process-shell-command cmd nil cmd)))))

Reply via email to