unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* send selection or current line to Terminal/iTerm
@ 2014-06-08 20:58 klebsiella
  2014-06-12 15:13 ` klebsiella
       [not found] ` <mailman.3499.1402586049.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 39+ messages in thread
From: klebsiella @ 2014-06-08 20:58 UTC (permalink / raw)
  To: Help-gnu-emacs

Dear all,

I am using Aquamacs/Emacs on MacOsX.
What I desire is to be able to send the current active line (and eventually
step to the next line) or current selection to the active Terminal session
on my iTerm. I know I can use isend for sending the output to a
"shell-buffer" launched in emacs but I prefer to use iTerm for that.

Is there a way to achieve that ?

Many thanks for your help
Best



--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  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
                     ` (2 more replies)
       [not found] ` <mailman.3499.1402586049.1147.help-gnu-emacs@gnu.org>
  1 sibling, 3 replies; 39+ messages in thread
From: klebsiella @ 2014-06-12 15:13 UTC (permalink / raw)
  To: Help-gnu-emacs

Hi Guys,
No reply to my request. Does anyone knows how to deal with the above
mentioned issue or at least give me some advises/hints ?





--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324374.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
       [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
  1 sibling, 0 replies; 39+ messages in thread
From: Emanuel Berg @ 2014-06-12 15:47 UTC (permalink / raw)
  To: help-gnu-emacs

klebsiella <pierre.khoueiry@embl.de> writes:

> Hi Guys, No reply to my request. Does anyone knows
> how to deal with the above mentioned issue or at
> least give me some advises/hints?

I think you didn't get a reply because the issue was
stated so software-specific - I actually never heard of
iTerm (or Aquamacs for that matter), though perhaps
that is common knowledge...

But, I've done a lot of similar stuff from/to Emacs (in
a Linux VT) to/from tmux which runs on top of other VTs
(or xterm in X).

The easiest way is to setup a function in Emacs that
writes the line (or region) to a file. Then setup a
shortcut in Mac OS X (or iTerm, or the shell that runs
in iTerm: bash, zsh, etc. in the Linux world) to insert
the line at the cursor position.

I can't be more specific but perhaps that'll get you
going. If you are familiar with Emacs Lisp, perhaps
how I did it [1] for the Linux VTs, tmux, and X - using a
tool called xsel - is of interest (which works
cross-system as long as X runs) - but most likely it
will only confuse you, so try the file solution first,
I think :)

Depending on how the clipboard works in Mac OS X, you
can use the variable interprogram-cut-function to get a
completely transparent kill ring. I got that working,
but I thought it was too much overhead for every single
kill, because many (most) of them are intended either
simply to remove stuff, or to yank somewhere else in
Emacs.

[1] http://user.it.uu.se/~embe8573/conf/emacs-init/x-clipboard.el

-- 
underground experts united:
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 15:13 ` klebsiella
@ 2014-06-12 15:49   ` Jai Dayal
  2014-06-12 16:00     ` klebsiella
       [not found]   ` <mailman.3500.1402588211.1147.help-gnu-emacs@gnu.org>
  2014-06-12 22:50   ` Robert Thorpe
  2 siblings, 1 reply; 39+ messages in thread
From: Jai Dayal @ 2014-06-12 15:49 UTC (permalink / raw)
  To: klebsiella; +Cc: help-gnu-emacs

Well, how do you expect Emacs to interact with a process executing outside
of its context?

How would you expect any other process, say Firefox, to interact with iterm?


On Thu, Jun 12, 2014 at 9:13 AM, klebsiella <pierre.khoueiry@embl.de> wrote:

> Hi Guys,
> No reply to my request. Does anyone knows how to deal with the above
> mentioned issue or at least give me some advises/hints ?
>
>
>
>
>
> --
> View this message in context:
> http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324374.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
>
>


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 15:49   ` Jai Dayal
@ 2014-06-12 16:00     ` klebsiella
  2014-06-12 16:02       ` Jai Dayal
  0 siblings, 1 reply; 39+ messages in thread
From: klebsiella @ 2014-06-12 16:00 UTC (permalink / raw)
  To: Help-gnu-emacs

Well, The way Sublime Text does it ... This is why I expect it to work with
Emacs ... 



--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324377.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 16:00     ` klebsiella
@ 2014-06-12 16:02       ` Jai Dayal
  0 siblings, 0 replies; 39+ messages in thread
From: Jai Dayal @ 2014-06-12 16:02 UTC (permalink / raw)
  To: klebsiella; +Cc: help-gnu-emacs

Okay, so how does sublime text do it?


On Thu, Jun 12, 2014 at 10:00 AM, klebsiella <pierre.khoueiry@embl.de>
wrote:

> Well, The way Sublime Text does it ... This is why I expect it to work with
> Emacs ...
>
>
>
> --
> View this message in context:
> http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324377.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
>
>


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
       [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>
  0 siblings, 2 replies; 39+ messages in thread
From: Emanuel Berg @ 2014-06-12 20:29 UTC (permalink / raw)
  To: help-gnu-emacs

Jai Dayal <dayalsoap@gmail.com> writes:

> Well, how do you expect Emacs to interact with a
> process executing outside of its context?

What are you talking about? Of course that is
possible!

Ever heard of IPC, pipes, redirection, temporary files,
shared clipboards, shared memory (or simply agreed-upon
files on the same local disk), clients and servers,
Emacs' executing shell commands, etc., etc.?

-- 
underground experts united:
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  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>
  1 sibling, 0 replies; 39+ messages in thread
From: Jai Dayal @ 2014-06-12 20:31 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

Correct, it's possible, but the applications that you're using have to be
programmed to expect information to come that way, right?

I'm surprised this has to be explained to you.

So, that's why I'm asking the OP how does Sublime Text do it with iterm?


On Thu, Jun 12, 2014 at 2:29 PM, Emanuel Berg <embe8573@student.uu.se>
wrote:

> Jai Dayal <dayalsoap@gmail.com> writes:
>
> > Well, how do you expect Emacs to interact with a
> > process executing outside of its context?
>
> What are you talking about? Of course that is
> possible!
>
> Ever heard of IPC, pipes, redirection, temporary files,
> shared clipboards, shared memory (or simply agreed-upon
> files on the same local disk), clients and servers,
> Emacs' executing shell commands, etc., etc.?
>
> --
> underground experts united:
> http://user.it.uu.se/~embe8573
>


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
       [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
       [not found]           ` <mailman.3511.1402605838.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 39+ messages in thread
From: Emanuel Berg @ 2014-06-12 20:36 UTC (permalink / raw)
  To: help-gnu-emacs

Jai Dayal <dayalsoap@gmail.com> writes:

> Correct, it's possible, but the applications that
> you're using have to be programmed to expect
> information to come that way, right?

Applications *always* have to be programmed to do
anything and everything, including communicating with
other applications.

> I'm surprised this has to be explained to you.

?!

> So, that's why I'm asking the OP how does Sublime
> Text do it with iterm?

Maybe the OP doesn't know *how* Sublime does it, he has
just observed that it can do it so he rightly assumes
other applications can do it as well?

-- 
underground experts united:
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  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>
  1 sibling, 1 reply; 39+ messages in thread
From: Jai Dayal @ 2014-06-12 20:43 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

>Applications *always* have to be programmed to do
anything and everything, including communicating with
other applications.

Correct. So your statement of "of course it's possible" is just a strawman
argument because I never said it was impossible. You then went on useless
rant about how to communicate with other processes, which is useless
because I asked specifically how SublimeText does it.

"
Maybe the OP doesn't know *how* Sublime does it, he has
just observed that it can do it so he rightly assumes
other applications can do it as well?"

If you can extend or change the application, sure. Absolutely.

So, again, how does Sublime Text do it?




On Thu, Jun 12, 2014 at 2:36 PM, Emanuel Berg <embe8573@student.uu.se>
wrote:

> Jai Dayal <dayalsoap@gmail.com> writes:
>
> > Correct, it's possible, but the applications that
> > you're using have to be programmed to expect
> > information to come that way, right?
>
> Applications *always* have to be programmed to do
> anything and everything, including communicating with
> other applications.
>
> > I'm surprised this has to be explained to you.
>
> ?!
>
> > So, that's why I'm asking the OP how does Sublime
> > Text do it with iterm?
>
> Maybe the OP doesn't know *how* Sublime does it, he has
> just observed that it can do it so he rightly assumes
> other applications can do it as well?
>
> --
> underground experts united:
> http://user.it.uu.se/~embe8573
>


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
       [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
       [not found]               ` <mailman.3513.1402607827.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 39+ messages in thread
From: Emanuel Berg @ 2014-06-12 21:10 UTC (permalink / raw)
  To: help-gnu-emacs

Jai Dayal <dayalsoap@gmail.com> writes:

> So your statement of "of course it's possible" is
> just a strawman argument because I never said it was
> impossible. You then went on useless rant about how
> to communicate with other processes, which is useless

I'm not getting into an argument over this. This is is
not a debate. I know what I write and if you consider
that useless to all and everyone that's a statement
that cannot be verified anyway.

> If you can extend or change the application, sure.

You don't necessarily need to change *the* application,
though that would help, of course. There are many other
applications that you may put in-between to do such a
thing.

The example I gave was the code I wrote for Emacs,
which was about half a page - to tmux, it was a
oneliner, and the glue in between - xsel - I simply
installed. Also note the Elisp code is just loaded by
the Emacs Lisp interpreter at startup time - and the
tmux oneliner is in a tmux configuration file. While
this is certainly programming it isn't anything
extremely difficult that involves branching,
recompilation, etc. Besides it doesn't matter how
difficult it supposedly is. If you want to do it, get
in someone's face and do it. Simple as that.

-- 
underground experts united:
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 21:10             ` Emanuel Berg
@ 2014-06-12 21:17               ` Jai Dayal
  2014-06-12 21:43                 ` klebsiella
       [not found]               ` <mailman.3513.1402607827.1147.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 39+ messages in thread
From: Jai Dayal @ 2014-06-12 21:17 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

Right, you had to write code for Emacs, meaning you had to extend upon
emacs.
On Jun 12, 2014 3:15 PM, "Emanuel Berg" <embe8573@student.uu.se> wrote:

> Jai Dayal <dayalsoap@gmail.com> writes:
>
> > So your statement of "of course it's possible" is
> > just a strawman argument because I never said it was
> > impossible. You then went on useless rant about how
> > to communicate with other processes, which is useless
>
> I'm not getting into an argument over this. This is is
> not a debate. I know what I write and if you consider
> that useless to all and everyone that's a statement
> that cannot be verified anyway.
>
> > If you can extend or change the application, sure.
>
> You don't necessarily need to change *the* application,
> though that would help, of course. There are many other
> applications that you may put in-between to do such a
> thing.
>
> The example I gave was the code I wrote for Emacs,
> which was about half a page - to tmux, it was a
> oneliner, and the glue in between - xsel - I simply
> installed. Also note the Elisp code is just loaded by
> the Emacs Lisp interpreter at startup time - and the
> tmux oneliner is in a tmux configuration file. While
> this is certainly programming it isn't anything
> extremely difficult that involves branching,
> recompilation, etc. Besides it doesn't matter how
> difficult it supposedly is. If you want to do it, get
> in someone's face and do it. Simple as that.
>
> --
> underground experts united:
> http://user.it.uu.se/~embe8573
>


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
       [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
  1 sibling, 0 replies; 39+ messages in thread
From: Hans BKK @ 2014-06-12 21:26 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, June 12, 2014 11:13:49 AM UTC-4, klebsiella wrote:
> No reply to my request. Does anyone knows how to deal with the above
> mentioned issue or at least give me some advises/hints ?

Maybe have a look at "Comint Mode", which is the basis for many "shell in a buffer" interactive modes such as SQL mode. . .


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 20:43           ` Jai Dayal
@ 2014-06-12 21:28             ` John Mastro
  0 siblings, 0 replies; 39+ messages in thread
From: John Mastro @ 2014-06-12 21:28 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

Jai Dayal <dayalsoap@gmail.com> wrote:
> So, again, how does Sublime Text do it?

I did a web search for "send text to iTerm" and found a SublimeText
extension called SendText[1]. I'm not sure if it's what the original
asker is using, and I don't have my Mac handy to test it at the moment,
but the bottom line is that it seems to be possible using a bit of
simple AppleScript.

[1] https://github.com/wch/SendText/blob/master/SendText.py

Best,

John


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
       [not found]               ` <mailman.3513.1402607827.1147.help-gnu-emacs@gnu.org>
@ 2014-06-12 21:35                 ` Emanuel Berg
  0 siblings, 0 replies; 39+ messages in thread
From: Emanuel Berg @ 2014-06-12 21:35 UTC (permalink / raw)
  To: help-gnu-emacs

Jai Dayal <dayalsoap@gmail.com> writes:

> Right, you had to write code for Emacs, meaning you
> had to extend upon emacs.

I don't know if I had to do it or if I just did it - so
what? Sometimes you do that, sometimes you
don't. Whatever solves the problem, solves the
problem. In the Apple world I suspect such hacking is
less common and perhaps more difficult as well
(compared to the Linux world) but Emacs should be just
as configurable/extendable and as for the rest of the
software there is no doubt in my mind that users come
up with little schemes and fixes to get the software as
they like it. And if they don't know how to do it, they
are more than welcome to ask at a place like this.

-- 
underground experts united:
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 21:17               ` Jai Dayal
@ 2014-06-12 21:43                 ` klebsiella
  2014-06-12 23:59                   ` Jai Dayal
  0 siblings, 1 reply; 39+ messages in thread
From: klebsiella @ 2014-06-12 21:43 UTC (permalink / raw)
  To: Help-gnu-emacs

@ Emanuel: Thanks for the reply and the suggestions. Unfortunately, I do not
know lisp beside the basics to optimize my .emacs.

@jai: I agree with Emanuel statements. Actually, I have posted a similar
post on Stackoverflow and somebody already explained how it can be done but
I couldn't make it work: You can check it on the link pasted below. However,
I posted the request here recently as I thought that their can be a more
elegant/builtin way to do it that I am not aware of ...
In summary, Sublime Text calls osascript to paste the active region in the
active session of the Terminal ...

Maybe if someone knows lisp enough can follow on the explanation given in
the link below and check if he/she can make it work ?

http://stackoverflow.com/questions/22835546/emacs-aquamacs-send-current-line-or-selection-to-active-terminal



--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324400.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 15:13 ` klebsiella
  2014-06-12 15:49   ` Jai Dayal
       [not found]   ` <mailman.3500.1402588211.1147.help-gnu-emacs@gnu.org>
@ 2014-06-12 22:50   ` Robert Thorpe
  2 siblings, 0 replies; 39+ messages in thread
From: Robert Thorpe @ 2014-06-12 22:50 UTC (permalink / raw)
  To: klebsiella; +Cc: Help-gnu-emacs

klebsiella <pierre.khoueiry@embl.de> writes:

> Hi Guys,
> No reply to my request. Does anyone knows how to deal with the above
> mentioned issue or at least give me some advises/hints ?

When you copy or cut the region to the kill-ring it should be present on
the system clipboard too.  So, AFAIK, this should work, though I don't
use Emacs on OS X that's the general rule.  I think it's an Aquamacs
bug.

Try the "Emacs on OS X" mailing list http://aquamacs.org/support.shtml .

(Are you saying you want the region copied *before* you copy or paste?
That's a different question.) 

BR,
Robert Thorpe



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 21:43                 ` klebsiella
@ 2014-06-12 23:59                   ` Jai Dayal
       [not found]                     ` <CAOj2CQRaRpKuTTgseGjfhk504BLRJ=J+9C76nj+W6Px2iL9X1Q@mail.gmail.com>
  2014-06-14 15:31                     ` Alan Schmitt
  0 siblings, 2 replies; 39+ messages in thread
From: Jai Dayal @ 2014-06-12 23:59 UTC (permalink / raw)
  To: klebsiella; +Cc: help-gnu-emacs

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>*


On Thu, Jun 12, 2014 at 3:43 PM, klebsiella <pierre.khoueiry@embl.de> wrote:

> @ Emanuel: Thanks for the reply and the suggestions. Unfortunately, I do
> not
> know lisp beside the basics to optimize my .emacs.
>
> @jai: I agree with Emanuel statements. Actually, I have posted a similar
> post on Stackoverflow and somebody already explained how it can be done but
> I couldn't make it work: You can check it on the link pasted below.
> However,
> I posted the request here recently as I thought that their can be a more
> elegant/builtin way to do it that I am not aware of ...
> In summary, Sublime Text calls osascript to paste the active region in the
> active session of the Terminal ...
>
> Maybe if someone knows lisp enough can follow on the explanation given in
> the link below and check if he/she can make it work ?
>
>
> http://stackoverflow.com/questions/22835546/emacs-aquamacs-send-current-line-or-selection-to-active-terminal
>
>
>
> --
> View this message in context:
> http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324400.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
>
>


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
       [not found]                     ` <CAOj2CQRaRpKuTTgseGjfhk504BLRJ=J+9C76nj+W6Px2iL9X1Q@mail.gmail.com>
@ 2014-06-13  0:55                       ` John Mastro
  2014-06-13 13:39                         ` klebsiella
  0 siblings, 1 reply; 39+ messages in thread
From: John Mastro @ 2014-06-13  0:55 UTC (permalink / raw)
  To: help-gnu-emacs

Hi klebsiella,

John Mastro <john.b.mastro@gmail.com> wrote:
> This is totally untested (sorry, still not around a Mac), but I think
> something along these lines should work. Assuming that SublimeText
> extension works anyway.

By the way, if the code I posted does do approximately want you want,
I'd be happy to improve it a bit for you (e.g. handling escaping, as the
SublimeText version seems to).

If you try it, let me know if/how it works for you.

- John


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  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
  0 siblings, 2 replies; 39+ messages in thread
From: klebsiella @ 2014-06-13 13:39 UTC (permalink / raw)
  To: Help-gnu-emacs

So guys,

First thank you all for your time.

Here is the code in my .emacs (see below) that is supposed to do the job
(Thanks go to @JordonBiondo - Stackoverflow and also to you John Mastro)

I am now working on emacs (not Aquamacs) and the code is still not working.
Again, as I do not know Lisp, it was hard for me to debug !!! 

The error message given is I guess thrown by osascript, but may be linked to
a syntax problem in lisp:

100:100: syntax error: Expected string but found end of script. (-2741)
Process send-text-iterm2-proc exited abnormally with code 1

Osascript itself is working. For instance the following line runs correctly
on the terminal:

$ osascript -e 'tell application "iTerm" ' -e 'set mysession to current
session of current terminal' -e 'tell mysession to write text "ls"' -e 'end
tell'

It would be great to make it run (For everybody I believe)

.emacs related chunk
(defun sendtext:escape-text(s):
  (with-temp-buffer
    (insert s)
    (replace-string "\\" "\\\\" nil (point-min) (point-max))
    (replace-string "\"" "\\\"" nil (point-min) (point-max))
    (buffer-substring-no-properties (point-min) (point-max))))

(defun sendtext:send-iterm2(beg end)
  (interactive "r")
  (let ((text (buffer-substring-no-properties beg end)))
    (start-process "send-text-iterm2-proc" "*sendtext:output*"
                   "osascript" 
                   "-e" "tell app \"iTerm\""
                   "-e" "set mysession to current session of current
terminal"
                   "-e" "tell mysession to write text \""
                   (sendtext:escape-text text)
                   "\""
                   "-e" "end tell")))
John Mastro wrote
> Hi klebsiella,
> 
> John Mastro &lt;

> john.b.mastro@

> &gt; wrote:
>> This is totally untested (sorry, still not around a Mac), but I think
>> something along these lines should work. Assuming that SublimeText
>> extension works anyway.
> 
> By the way, if the code I posted does do approximately want you want,
> I'd be happy to improve it a bit for you (e.g. handling escaping, as the
> SublimeText version seems to).
> 
> If you try it, let me know if/how it works for you.
> 
> - John





--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324448.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-13 13:39                         ` klebsiella
@ 2014-06-13 16:51                           ` John Mastro
  2014-06-14  2:30                           ` John Mastro
  1 sibling, 0 replies; 39+ messages in thread
From: John Mastro @ 2014-06-13 16:51 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

klebsiella <pierre.khoueiry@embl.de> wrote:
> I am now working on emacs (not Aquamacs) and the code is still not
> working. Again, as I do not know Lisp, it was hard for me to debug !!!

I'll have a chance to get in front of my Mac tonight. If nobody beats me
to it, I'll try to get you something working then.

Best,

John


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  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
  1 sibling, 1 reply; 39+ messages in thread
From: John Mastro @ 2014-06-14  2:30 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi klebsiella,

I have another version for you to try. It behaved as expected in a few
simple tests on my machine.

Let me know how it goes.

Best,

John

;;; Begin iterm.el

;; To match SublimeText's key binding:
;; (global-set-key (kbd "<C-return>") 'iterm-send-text)

(require 'pcase)
(require 'thingatpt)

(defun iterm-escape-string (str)
  (let* ((str (replace-regexp-in-string "\\\\" "\\\\" str nil t))
         (str (replace-regexp-in-string "\"" "\\\"" str nil t)))
    str))

(defun iterm-last-char-p (str char)
  (let ((length (length str)))
    (and (> length 0)
         (string= (substring str (- length 1)) (string char)))))

(defun iterm-chop-newline (str)
  (let ((length (length str)))
    (if (iterm-last-char-p str ?\n)
        (substring str 0 (- length 1))
      str)))

(defun iterm-maybe-add-newline (str)
  (if (iterm-last-char-p str ? )
      (concat str "\n")
    str))

(defun iterm-handle-newline (str)
  (iterm-maybe-add-newline (iterm-chop-newline str)))

(defun iterm-send-string (str)
  "Send STR to a running iTerm instance."
  (let ((str (iterm-escape-string (iterm-handle-newline str))))
    (shell-command
     (concat "osascript -e 'tell app \"iTerm\"' "
             "-e 'set mysession to current session of current terminal' "
             (format "-e 'tell mysession to write text \"%s\"' " str)
             "-e 'end tell'"))))

(defun iterm-text-bounds ()
  (pcase-let ((`(,beg . ,end) (if (use-region-p)
                                  (cons (region-beginning) (region-end))
                                (bounds-of-thing-at-point 'symbol))))
    (list beg end)))

(defun iterm-send-text (beg end)
  "Send buffer text in region from BEG to END to iTerm.
If called interactively without an active region, send the symbol
at point instead."
  (interactive (iterm-text-bounds))
  (let ((str (iterm-escape-string (buffer-substring-no-properties beg
end))))
    (iterm-send-string str)))

(provide 'iterm)


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14  2:30                           ` John Mastro
@ 2014-06-14  6:52                             ` klebsiella
  2014-06-14 14:22                               ` Robert Thorpe
  2014-06-14 16:52                               ` John Mastro
  0 siblings, 2 replies; 39+ messages in thread
From: klebsiella @ 2014-06-14  6:52 UTC (permalink / raw)
  To: Help-gnu-emacs

Hi John,

It works like a charm ... very efficient,

Though, one small improvement will be to send the whole current line,
instead of the symbol only, when no region is selected.

- For instance, the following will fail if x is not defined unless the whole
line is selected
x <- c(1:3)  ;; in an R terminal
- This also will fail when sending to a shell instance on iterm
ls -laih

Also, but very minor, would be to strip/skip empty lines and eventually move
cursor to the next line of code (but this is really not very important)

All best and thanks again for the very good job

K.



--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324525.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14  6:52                             ` klebsiella
@ 2014-06-14 14:22                               ` Robert Thorpe
  2014-06-14 15:09                                 ` klebsiella
       [not found]                                 ` <mailman.3652.1402758599.1147.help-gnu-emacs@gnu.org>
  2014-06-14 16:52                               ` John Mastro
  1 sibling, 2 replies; 39+ messages in thread
From: Robert Thorpe @ 2014-06-14 14:22 UTC (permalink / raw)
  To: klebsiella; +Cc: Help-gnu-emacs

klebsiella <pierre.khoueiry@embl.de> writes:

> Hi John,
>
> It works like a charm ... very efficient,
>
> Though, one small improvement will be to send the whole current line,
> instead of the symbol only, when no region is selected.

I still can't work out why you have to do all this.  If I understood
your first posts all you want is inter-program paste.  That should just
work.

I don't have to do anything special to paste into an xterm or a
gnome-terminal on Xubuntu, it just works.

You should try to find the intended way to do this.  Recently I've seen
two posts (one here and one on Reddit/Emacs) where people have tried to
work around clipboard problems using xsel and it hasn't worked properly.
The system functions for clipboard interaction, like xsel in X11, are
quite difficult to use correctly.

Have you tried reporting this to the maintainers of Aquamacs or
Emacs-for-OSX?

BR,
Robert Thorpe



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  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>
  1 sibling, 1 reply; 39+ messages in thread
From: klebsiella @ 2014-06-14 15:09 UTC (permalink / raw)
  To: Help-gnu-emacs

Dear Robert,

Paste is working fine. The idea of sending the current line or selection to
the terminal allows
1) To avoid the selection and copy steps, when a line needed to be executed,
or the copy step in a selection 
2) To keep the focus on the code when you send something to get executed
3) I personally like iTerm. I have tried emacs shell, coupled with ess-mode
of course or simply isend-mode, to interact with R in my case, but found it
inconvenient in some ways (i.e copy pasting in the shell buffer, inside an R
process, caused me always problems. !!! )
4) last, I like emacs and I knew that this feature (sending current
selection or line to Terminal) is implemented/builtin in other editors. I
wanted to make it run on my emacs (maybe just to prove that we can do
everything with emacs - and yes we can).

All best,
K.



--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324553.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-12 23:59                   ` Jai Dayal
       [not found]                     ` <CAOj2CQRaRpKuTTgseGjfhk504BLRJ=J+9C76nj+W6Px2iL9X1Q@mail.gmail.com>
@ 2014-06-14 15:31                     ` Alan Schmitt
  1 sibling, 0 replies; 39+ messages in thread
From: Alan Schmitt @ 2014-06-14 15:31 UTC (permalink / raw)
  To: Jai Dayal; +Cc: help-gnu-emacs, klebsiella

[-- 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 --]

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14  6:52                             ` klebsiella
  2014-06-14 14:22                               ` Robert Thorpe
@ 2014-06-14 16:52                               ` John Mastro
  2014-06-14 18:09                                 ` klebsiella
  1 sibling, 1 reply; 39+ messages in thread
From: John Mastro @ 2014-06-14 16:52 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi klebsiella,

klebsiella <pierre.khoueiry@embl.de> wrote:
> It works like a charm ... very efficient,
>
> Though, one small improvement will be to send the whole current line,
> instead of the symbol only, when no region is selected.

[snip]

> Also, but very minor, would be to strip/skip empty lines and
> eventually move cursor to the next line of code (but this is really
> not very important) All best and thanks again for the very good job

You're welcome - I'm glad it worked.

Here's a version with the changes you suggested. The "thing" to send
when there's no active region (i.e. selection) is configurable,
with the current line as the default.

Let me know if it's what you have in mind.

By the way - is this useful for others? If so I could release it on e.g.
MELPA.

Best,

John

;;; iterm.el - send text to a running iTerm instance

(require 'pcase)
(require 'thingatpt)

;; To match SublimeText's key binding:
;; (global-set-key (kbd "<C-return>") 'iterm-send-text)

(defvar iterm-default-thing 'line
  "The \"thing\" to send if no region is active.
Can be any symbol understood by `bounds-of-thing-at-point'.")

(defvar iterm-empty-line-regexp "^[[:space:]]*$"
  "Regexp to match empty lines, which will not be sent to iTerm.
Set to nil to disable removing empty lines.")

(defun iterm-escape-string (str)
  (let* ((str (replace-regexp-in-string "\\\\" "\\\\" str nil t))
         (str (replace-regexp-in-string "\"" "\\\"" str nil t)))
    str))

(defun iterm-last-char-p (str char)
  (let ((length (length str)))
    (and (> length 0)
         (char-equal (elt str (- length 1)) char))))

(defun iterm-chop-newline (str)
  (let ((length (length str)))
    (if (iterm-last-char-p str ?\n)
        (substring str 0 (- length 1))
      str)))

(defun iterm-maybe-add-newline (str)
  (if (iterm-last-char-p str ? )
      (concat str "\n")
    str))

(defun iterm-handle-newline (str)
  (iterm-maybe-add-newline (iterm-chop-newline str)))

(defun iterm-maybe-remove-empty-lines (str)
  (if iterm-empty-line-regexp
      (let ((regexp iterm-empty-line-regexp)
            (lines (split-string str "\n")))
        (mapconcat 'identity
                   (delq nil (mapcar (lambda (line)
                                       (unless (string-match-p regexp line)
                                         line))
                                     lines))
                   "\n"))
    str))

(defun iterm-send-string (str)
  "Send STR to a running iTerm instance."
  (let* ((str (iterm-maybe-remove-empty-lines str))
         (str (iterm-handle-newline str))
         (str (iterm-escape-string str)))
    (shell-command
     (concat "osascript -e 'tell app \"iTerm\"' "
             "-e 'set mysession to current session of current terminal' "
             (format "-e 'tell mysession to write text \"%s\"' " str)
             "-e 'end tell'"))))

(defun iterm-text-bounds ()
  (pcase-let ((`(,beg . ,end) (if (use-region-p)
                                  (cons (region-beginning) (region-end))
                                (bounds-of-thing-at-point
                                 iterm-default-thing))))
    (list beg end)))

(defun iterm-send-text (beg end)
  "Send buffer text in region from BEG to END to iTerm.
If called interactively without an active region, send the symbol
at point instead."
  (interactive (iterm-text-bounds))
  (let ((str (iterm-escape-string (buffer-substring-no-properties beg
end))))
    (iterm-send-string str))
  (forward-line 1))

(provide 'iterm)


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14 16:52                               ` John Mastro
@ 2014-06-14 18:09                                 ` klebsiella
  2014-06-14 18:36                                   ` John Mastro
  0 siblings, 1 reply; 39+ messages in thread
From: klebsiella @ 2014-06-14 18:09 UTC (permalink / raw)
  To: Help-gnu-emacs

Dear John,

Many thanks again. One error was produced (I believe this will be the last
;)), when the assignment contains quotes. i.e the following will produce in
error in R:

file <- "myFile.txt"
Error:
> file <- \"myFile.txt\"
Error: unexpected input in "file <- \"

I believe that "iterm-escape-string" is replacing the quote (") by (\"),
which is sent to iTerm then.
Also, is it important to have the first replacement in "iterm-escape-string"
(replace-regexp-in-string "\\\\" "\\\\" str nil t). I find it useless
myself, unless if I am missing something,

I do believe that it can be useful for others but maybe additional tests
have to be done. I will be happy to report bugs in such a case.

All best




--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324572.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14 18:09                                 ` klebsiella
@ 2014-06-14 18:36                                   ` John Mastro
  2014-06-14 19:01                                     ` klebsiella
  0 siblings, 1 reply; 39+ messages in thread
From: John Mastro @ 2014-06-14 18:36 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi,

klebsiella <pierre.khoueiry@embl.de> wrote:
> Many thanks again. One error was produced (I believe this will be the
> last ;)), when the assignment contains quotes. i.e the following will
> produce in error in R:
>
> file <- "myFile.txt"
> Error:
> > file <- \"myFile.txt\"
> Error: unexpected input in "file <- \"
>
> I believe that "iterm-escape-string" is replacing the quote (") by
> (\"), which is sent to iTerm then. Also, is it important to have the
> first replacement in "iterm-escape-string" (replace-regexp-in-string
> "\\\\" "\\\\" str nil t). I find it useless myself, unless if I am
> missing something,

Does something different happen if you do the same thing from
SublimeText? I based the escaping on what the SublimeText plugin does. I
can change it, I just want to understand whether what's there now is
reproducing what the ST plugin is doing.

- John


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14 15:09                                 ` klebsiella
@ 2014-06-14 18:59                                   ` Robert Thorpe
  0 siblings, 0 replies; 39+ messages in thread
From: Robert Thorpe @ 2014-06-14 18:59 UTC (permalink / raw)
  To: klebsiella; +Cc: Help-gnu-emacs

klebsiella <pierre.khoueiry@embl.de> writes:

> Dear Robert,
>
> Paste is working fine. The idea of sending the current line or selection to
> the terminal allows

Ah, I see now.  I had a look at the elisp that John Mastro wrote.  It
may be better to use interprogram cut to move data from Emacs to the
clipboard, then get the Applescript to paste it in.  I don't know if
osascript can take symbols and non-ascii characters on it's command
line.  If it can then it'll work fine the way you have it, if not then
it could be a problem.  (I don't know if Applescript can access the
clipboard, if not then you don't have a choice).

BR,
Robert Thorpe



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14 18:36                                   ` John Mastro
@ 2014-06-14 19:01                                     ` klebsiella
  2014-06-14 19:24                                       ` John Mastro
  0 siblings, 1 reply; 39+ messages in thread
From: klebsiella @ 2014-06-14 19:01 UTC (permalink / raw)
  To: Help-gnu-emacs

It works fine from SublimeText !!!!



--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324577.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14 19:01                                     ` klebsiella
@ 2014-06-14 19:24                                       ` John Mastro
  2014-06-14 19:53                                         ` klebsiella
  0 siblings, 1 reply; 39+ messages in thread
From: John Mastro @ 2014-06-14 19:24 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

klebsiella <pierre.khoueiry@embl.de> wrote:
> It works fine from SublimeText !!!!

Oops, I was double-escaping. I think that was the problem.

I posted a new version as a gist[1]. If you still get that error I'll ditch
the escaping entirely.

[1] https://gist.github.com/johnmastro/88cc318f4ce33b626c9d

Best,

John


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-14 19:24                                       ` John Mastro
@ 2014-06-14 19:53                                         ` klebsiella
  0 siblings, 0 replies; 39+ messages in thread
From: klebsiella @ 2014-06-14 19:53 UTC (permalink / raw)
  To: Help-gnu-emacs

It works perfectly fine now ... Sweet.

Many thanks again for the efforts John. I am sure people will be happy to
discover this package.

All best,





--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324581.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
       [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
  0 siblings, 2 replies; 39+ messages in thread
From: Rusi @ 2014-06-17 14:11 UTC (permalink / raw)
  To: help-gnu-emacs

On Saturday, June 14, 2014 8:39:43 PM UTC+5:30, klebsiella wrote:
> Dear Robert,

> Paste is working fine. The idea of sending the current line or selection to
> the terminal allows
> 1) To avoid the selection and copy steps, when a line needed to be executed,
> or the copy step in a selection 
> 2) To keep the focus on the code when you send something to get executed
> 3) I personally like iTerm. I have tried emacs shell, coupled with ess-mode
> of course or simply isend-mode, to interact with R in my case, but found it
> inconvenient in some ways (i.e copy pasting in the shell buffer, inside an R
> process, caused me always problems. !!! )
> 4) last, I like emacs and I knew that this feature (sending current
> selection or line to Terminal) is implemented/builtin in other editors. I
> wanted to make it run on my emacs (maybe just to prove that we can do
> everything with emacs - and yes we can).

> All best,
> K.

I believe eev/eepitch has this intent
http://angg.twu.net/eev-intros/find-eepitch-intro.html

[I found the idea interesting/powerful but the docs too confused to
be able to get into it]


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-17 14:11                                   ` Rusi
@ 2014-06-17 15:58                                     ` klebsiella
  2014-06-17 18:46                                     ` klebsiella
  1 sibling, 0 replies; 39+ messages in thread
From: klebsiella @ 2014-06-17 15:58 UTC (permalink / raw)
  To: Help-gnu-emacs

From what I understood, it will be interacting with a shell-buffer, that is
an emacs shell buffer.
My intent is to send the current selection or line to  active
console/terminal that is not a buffer in emacs.
Such terminals are iTerm or Terminal.app on OSX.

John Mastro iterm.el package allows to send the current selection or line to
the active iTerm session. With a bit of tweaking, on can send it to
Terminal.app or others under OSX.
 




--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324763.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  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
  1 sibling, 2 replies; 39+ messages in thread
From: klebsiella @ 2014-06-17 18:46 UTC (permalink / raw)
  To: Help-gnu-emacs

Hi again John,
I found a little bug in the package. Printing tabs, carriage return, or any
other character is problematic.
It has to do with "escaping". "iterm.el" is not sending the right info. 

In principle, everything inside the quotes, including the quotes themselves,
should be send to iTerm without processing

For instance, all of the following fail:

echo -en "\t" (gives nothing while a \t is expected
echo -en "\n" 
echo -en "\a"
echo -en "\\\"

Hope this will help,
Otherwise, the tool is great.

K.



--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324775.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-17 18:46                                     ` klebsiella
@ 2014-06-17 19:55                                       ` John Mastro
  2014-06-18  1:11                                       ` Robert Thorpe
  1 sibling, 0 replies; 39+ messages in thread
From: John Mastro @ 2014-06-17 19:55 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi klebsiella,

klebsiella <pierre.khoueiry@embl.de> wrote:
> I found a little bug in the package. Printing tabs, carriage return,
> or any other character is problematic.
> It has to do with "escaping". "iterm.el" is not sending the right
> info.

I'll try to take a look tonight or tomorrow. In the meantime, please try
it with a fresh copy from the gist[1]. I fixed an error related to
escaping since we last discussed it. I don't know whether it's related
or not but it's worth a shot.

[1] https://gist.github.com/johnmastro/88cc318f4ce33b626c9d

Best,

John


^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  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
  1 sibling, 1 reply; 39+ messages in thread
From: Robert Thorpe @ 2014-06-18  1:11 UTC (permalink / raw)
  To: klebsiella; +Cc: help-gnu-emacs

klebsiella <pierre.khoueiry@embl.de> writes:

> Hi again John,
> I found a little bug in the package. Printing tabs, carriage return, or any
> other character is problematic.
> It has to do with "escaping". "iterm.el" is not sending the right info. 

It's probably best to use inter-program paste to move the information,
then get Applescript to pick up the text block from there.  Moving this
kind of stuff on command lines often causes problems.

(I wrote an earlier email explaining this but it seems not to have
reached the list).

BR,
Robert Thorpe



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: send selection or current line to Terminal/iTerm
  2014-06-18  1:11                                       ` Robert Thorpe
@ 2014-06-18 11:30                                         ` klebsiella
  0 siblings, 0 replies; 39+ messages in thread
From: klebsiella @ 2014-06-18 11:30 UTC (permalink / raw)
  To: Help-gnu-emacs

I agree with you Robert,

My limited knowledge in Lisp/eLisp and lack of time for the moment to learn
it leave me with no choice for trying what you are suggesting.

John package (iTerm.el) works perfectly fine. It need some tweaks here and
there but for the short time that he wrote it with, it is a very
nice/functional toy. Treating with regexp is always hard.

best,







--
View this message in context: http://emacs.1067599.n5.nabble.com/send-selection-or-current-line-to-Terminal-iTerm-tp324145p324809.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2014-06-18 11:30 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
     [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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).