I am trying to open pdf files in specific folder using org mode.
For example, in a org file
My sample org file. Here is an external link: file:test.pdf
When I click on the link, it should open the file
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
#! /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
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.