From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Jai Dayal <dayalsoap@gmail.com>
Cc: help-gnu-emacs <Help-gnu-emacs@gnu.org>,
klebsiella <pierre.khoueiry@embl.de>
Subject: Re: send selection or current line to Terminal/iTerm
Date: Sat, 14 Jun 2014 17:31:34 +0200 [thread overview]
Message-ID: <m2sin7tsmh.fsf@polytechnique.org> (raw)
In-Reply-To: <CAMJ-YiSiVqTy+pPsyyqwj2weZZFfQnyMzzD8GhjD7-Cw6a1wgQ@mail.gmail.com> (Jai Dayal's message of "Thu, 12 Jun 2014 17:59:20 -0600")
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
On 2014-06-13 01:59, Jai Dayal <dayalsoap@gmail.com> 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
> <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
[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]
next prev parent reply other threads:[~2014-06-14 15:31 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-08 20:58 send selection or current line to Terminal/iTerm klebsiella
2014-06-12 15:13 ` klebsiella
2014-06-12 15:49 ` Jai Dayal
2014-06-12 16:00 ` klebsiella
2014-06-12 16:02 ` Jai Dayal
[not found] ` <mailman.3500.1402588211.1147.help-gnu-emacs@gnu.org>
2014-06-12 20:29 ` Emanuel Berg
2014-06-12 20:31 ` Jai Dayal
[not found] ` <mailman.3510.1402605133.1147.help-gnu-emacs@gnu.org>
2014-06-12 20:36 ` Emanuel Berg
2014-06-12 20:43 ` Jai Dayal
2014-06-12 21:28 ` John Mastro
[not found] ` <mailman.3511.1402605838.1147.help-gnu-emacs@gnu.org>
2014-06-12 21:10 ` Emanuel Berg
2014-06-12 21:17 ` Jai Dayal
2014-06-12 21:43 ` klebsiella
2014-06-12 23:59 ` Jai Dayal
[not found] ` <CAOj2CQRaRpKuTTgseGjfhk504BLRJ=J+9C76nj+W6Px2iL9X1Q@mail.gmail.com>
2014-06-13 0:55 ` John Mastro
2014-06-13 13:39 ` klebsiella
2014-06-13 16:51 ` John Mastro
2014-06-14 2:30 ` John Mastro
2014-06-14 6:52 ` klebsiella
2014-06-14 14:22 ` Robert Thorpe
2014-06-14 15:09 ` klebsiella
2014-06-14 18:59 ` Robert Thorpe
[not found] ` <mailman.3652.1402758599.1147.help-gnu-emacs@gnu.org>
2014-06-17 14:11 ` Rusi
2014-06-17 15:58 ` klebsiella
2014-06-17 18:46 ` klebsiella
2014-06-17 19:55 ` John Mastro
2014-06-18 1:11 ` Robert Thorpe
2014-06-18 11:30 ` klebsiella
2014-06-14 16:52 ` John Mastro
2014-06-14 18:09 ` klebsiella
2014-06-14 18:36 ` John Mastro
2014-06-14 19:01 ` klebsiella
2014-06-14 19:24 ` John Mastro
2014-06-14 19:53 ` klebsiella
2014-06-14 15:31 ` Alan Schmitt [this message]
[not found] ` <mailman.3513.1402607827.1147.help-gnu-emacs@gnu.org>
2014-06-12 21:35 ` Emanuel Berg
2014-06-12 22:50 ` Robert Thorpe
[not found] ` <mailman.3499.1402586049.1147.help-gnu-emacs@gnu.org>
2014-06-12 15:47 ` Emanuel Berg
2014-06-12 21:26 ` Hans BKK
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2sin7tsmh.fsf@polytechnique.org \
--to=alan.schmitt@polytechnique.org \
--cc=Help-gnu-emacs@gnu.org \
--cc=dayalsoap@gmail.com \
--cc=pierre.khoueiry@embl.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.