Tuesday, 3 September 2013

How open a *.pdf with Skim using start-process so that it has focus

How open a *.pdf with Skim using start-process so that it has focus

Could anyone please give me a hand to open a *.pdf using Skim so that it
has focus. Skim opens the file correctly, but remains in the background.
I'm using a recent version of Emacs Trunk on an OSX machine.
If I insert something like "open -a" or "open -o" before the absolute path
to Skim, then Emacs complains that there is no application by that name.
I've tried placing "-o" after the filename, but that didn't have any
affect.
The following code is for Wanderlust, but I assume that start-process is
universal.
(eval-after-load "mime-view"
'(progn
(ctree-set-calist-strictly
'mime-acting-condition
'((mode . "play")
(type . application)(subtype . pdf)
(method . lawlist-mime-view)))))
(defun lawlist-mime-view (&optional a b)
(let* ((entity (get-text-property (point) 'mime-view-entity))
(filename (mime-entity-safe-filename entity)))
(mime-write-entity-content entity (concat "/tmp/" filename))
(process-kill-without-query
(start-process "hello-world" nil
"/Applications/Skim.app/Contents/MacOS/Skim" filename))))

No comments:

Post a Comment