unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Getting ansi-term(?) to do something via elisp
@ 2011-01-10 10:03 Gary
  0 siblings, 0 replies; 3+ messages in thread
From: Gary @ 2011-01-10 10:03 UTC (permalink / raw)
  To: help-gnu-emacs

I am trying to "script" part of connecting to a remote server as part of
a mode I am working on. What I've discovered is that the remote server
seems to be sending colour control sequences as part of the output, so a
normal shell looks "strange". Is there any alternative to using
something like

,----
| (let ((mypass (read-passwd "Login password for user@server: "
|               )
|      ))
|   (start-process-shell-command foo
|                                "foo"
|                                "ssh bar@foo")
|   (process-send-string foo (concat mypass "\n"))
| ...
`----

perhaps using ansi-term, which can handle the control sequences?

I thought of just trying to send the commands that I need ("ssh" and so
on) to an ansi-term buffer, but don't know how to get hold of the
process.

-- 
Gary        Please do NOT send me 'courtesy' replies off-list.




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

* Re: Getting ansi-term(?) to do something via elisp
       [not found] <mailman.3.1294653860.11614.help-gnu-emacs@gnu.org>
@ 2011-01-11 20:58 ` Tim X
  2011-01-12  7:51   ` Gary
  0 siblings, 1 reply; 3+ messages in thread
From: Tim X @ 2011-01-11 20:58 UTC (permalink / raw)
  To: help-gnu-emacs

Gary <help-gnu-emacs@garydjones.name> writes:

> I am trying to "script" part of connecting to a remote server as part of
> a mode I am working on. What I've discovered is that the remote server
> seems to be sending colour control sequences as part of the output, so a
> normal shell looks "strange". Is there any alternative to using
> something like
>
> ,----
> | (let ((mypass (read-passwd "Login password for user@server: "
> |               )
> |      ))
> |   (start-process-shell-command foo
> |                                "foo"
> |                                "ssh bar@foo")
> |   (process-send-string foo (concat mypass "\n"))
> | ...
> `----
>
> perhaps using ansi-term, which can handle the control sequences?
>
> I thought of just trying to send the commands that I need ("ssh" and so
> on) to an ansi-term buffer, but don't know how to get hold of the
> process.

Do an apropos for 'ansi-color'. You will find a number of functions and
variables used to process ansi colour escape sequences from comint
buffers. Should be able to setup soemthing using the process output
filter that will handle these escape sequences. 

Tim

-- 
tcross (at) rapttech dot com dot au


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

* Re: Getting ansi-term(?) to do something via elisp
  2011-01-11 20:58 ` Getting ansi-term(?) to do something via elisp Tim X
@ 2011-01-12  7:51   ` Gary
  0 siblings, 0 replies; 3+ messages in thread
From: Gary @ 2011-01-12  7:51 UTC (permalink / raw)
  To: help-gnu-emacs

Tim X wrote:
> Gary writes:
>
>> I am trying to "script" part of connecting to a remote server as part
> of
>> a mode I am working on. What I've discovered is that the remote server
>> seems to be sending colour control sequences as part of the output, so
> a
>> normal shell looks "strange". Is there any alternative to using
>> something like
>>
>> ,----
...
>> |   (start-process-shell-command foo
...
>> `----
>>
>> perhaps using ansi-term, which can handle the control sequences?
>>
>> I thought of just trying to send the commands that I need ("ssh" and
> so
>> on) to an ansi-term buffer, but don't know how to get hold of the
>> process.
>
> Do an apropos for 'ansi-color'. You will find a number of functions and
> variables used to process ansi colour escape sequences from comint
> buffers. Should be able to setup soemthing using the process output
> filter that will handle these escape sequences. 

Too late ;) but thanks anyway :)

I found get-buffer-process and am using that on an ansi-term buffer I
create for the purpose, which seems to work adequately for what I want.




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

end of thread, other threads:[~2011-01-12  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.3.1294653860.11614.help-gnu-emacs@gnu.org>
2011-01-11 20:58 ` Getting ansi-term(?) to do something via elisp Tim X
2011-01-12  7:51   ` Gary
2011-01-10 10:03 Gary

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).