I am trying to open pdf files in specific folder using org mode.
For example, in a org file test.org:
My sample org file. Here is an external link: file:test.pdf
When I click on the link, it should open the file /home/hakon/my_pdf_files/test.pdf.
I have tried this: I added the following to my Emacs init file:
(eval-after-load "org"
'(progn
(setcdr (assoc "\\.pdf\\'" org-file-apps) "/home/hakon/my_org_pdf_viewer.sh %s")))
Where the shell script my_org_pdf_viewer.sh is:
#! /bin/bash
file_name=$(basename $1)
evince ~/my_pdf_files/"$file_name"
However this only works if the file name in the external link in test.org : file:test.pdf also exists as file name in the same folder as test.org, which is usually not the case. If the file does not exist in that directory, Emacs shows
No such file: <path/test.pdf>
in the echo area.