On 2014-06-13 01:59, Jai Dayal writes: > Okay, good, so it calls applescript. > > Is there a way to have emacs call applescript programs? > > It seems "yes", but I can't tell for sure. > > *http://www.emacswiki.org/emacs/EmacsForMacOS#toc21 > * This file (in org mode contrib) http://orgmode.org/cgit.cgi/org-mode.git/tree/contrib/lisp/org-mac-link.el shows how to do it. I think this is the relevant code. #+begin_src emacs-lisp ;; In mac.c, removed in Emacs 23. (declare-function do-applescript "org-mac-message" (script)) (unless (fboundp 'do-applescript) ;; Need to fake this using shell-command-to-string (defun do-applescript (script) (let (start cmd return) (while (string-match "\n" script) (setq script (replace-match "\r" t t script))) (while (string-match "'" script start) (setq start (+ 2 (match-beginning 0)) script (replace-match "\\'" t t script))) (setq cmd (concat "osascript -e '" script "'")) (setq return (shell-command-to-string cmd)) (concat "\"" (org-trim return) "\"")))) #+end_src Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7