I'm trying to tweak the dired-find-file
function in emacs on Windows XP so that when I open (say) a pdf file from dired it fires up a copy of Acrobat Reader and opens that file with it, instead of opening it within emacs. But I can't work out what variant on shell-command/call-process
to use. Here's what I have so far:
(defadvice dired-find-file (around dired-find-file-external (filename &optional wildcards))
"Open non-text files with an appropriate external program."
(if (string= ".pdf" (substring filename (- (length filename) 4))) ; obviously I'll replace this with something more general/robust
(shell-command filename) ;; what should go here?
(ad-do-it)))
(ad-activate 'dired-find-file)
I know I could hard-code it to start Acrobat Reader by giving it the location of the .exe file. But I'd rather have something which requires less searching from me and which won't break when default applications move/change. What should I use?