I would like to have emacsclient
as my default application for opening pdf-files, when openning them from within Emacs, based on a similar post emacsclient opens a file and does eval simultaneously. Moreover I'd like the ability to jump to a specific page in that file, when the file is opened in an org-mode
buffer where file-path::pg e.g. [[file:~/myfile.pdf::2][pg 2 of My File]], opens the pdf file on the desired page, when invoking C-c C-o
or org-open-at-point
.
I'd expect the following in my init.el
to effect the desired result:
(setq org-file-apps '(("\\.pdf::\\([0-9]+\\)\\'" .
"emacsclient -e '(progn
(find-file \"%s\")
(pdf-view-goto-page +%1)
)'"
)))
The problem is that on execution,find-file \"%s\"
, the double quotations are not escaped and do not show up in the command that is actually run. i.e. I get find-file /path/to/file
instead of find-file "/path/to/file"
Why are the escaped "
being ignored and how do I escape them so that they wrap around the %s
when the command is run?