emacs - How to open a *.pdf with Skim using start-process so that it has focus -
could please give me hand open *.pdf using skim has focus. skim opens file correctly, remains in background. i'm using recent version of emacs trunk on osx machine.
if insert "open -a" or "open -o" before absolute path skim, emacs complains there no application name. i've tried placing "-o" after filename, didn't have affect.
the following code wanderlust, assume start-process
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 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))))
edit -- 1: here simplistic function diagnosing problem. have created *.pdf file , saved "/tmp/test.pdf"
.
(defun test-start-process () (interactive) (start-process "hello-world" nil "open" "-a skim" "/tmp/test.pdf"))
edit -- 2: here revised working code tungd
-- appreciated!
(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 b) (let* ( (entity (get-text-property (point) 'mime-view-entity)) (name (mime-entity-safe-filename entity)) (filename (concat "/tmp/" name)) ) (mime-write-entity-content entity filename) (start-process "hello-world" nil "open" "-a" "skim" filename)))
i think open
easiest way. definition of start-process
is:
(start-process name buffer program &rest program-args)
so have use so:
(start-process "hello-world" nil "open" "-a" "skim" filename)
Comments
Post a Comment