9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] p9p 9term problem
@ 2011-01-26 12:21 Rudolf Sykora
  2011-01-26 16:05 ` Mantas Mikulėnas
  0 siblings, 1 reply; 6+ messages in thread
From: Rudolf Sykora @ 2011-01-26 12:21 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

in linux I often start programs from a terminal running bash like this
; (program &)
which somehow achieves to run the program in the background and the
program further survives the terminal's end.

When I write the command I often forget to write the opening '('. So,
in 9term, I click at the line beginning, add the '(', click at the
line end, hit enter. And I see:

bash: syntax error near unexpected token `)'

although the line looks correct --- when I highlight it and 'send', it works.

Something goes wrong...
Is it just my problem?

Thanks
Ruda



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

* Re: [9fans] p9p 9term problem
  2011-01-26 12:21 [9fans] p9p 9term problem Rudolf Sykora
@ 2011-01-26 16:05 ` Mantas Mikulėnas
  2011-01-26 21:12   ` Rudolf Sykora
  2011-01-27  1:37   ` Russ Cox
  0 siblings, 2 replies; 6+ messages in thread
From: Mantas Mikulėnas @ 2011-01-26 16:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Wed, 26 Jan 2011 13:21:10 +0100, Rudolf Sykora wrote:
> in linux I often start programs from a terminal running bash like
> this
> ; (program &)
> which somehow achieves to run the program in the background and the
> program further survives the terminal's end.

It's called "double-fork", AFAIK.

You can also use `disown` (as in `program & disown`) to achieve the same thing.

> When I write the command I often forget to write the opening '('. So,
> in 9term, I click at the line beginning, add the '(', click at the
> line end, hit enter. And I see:
>
> bash: syntax error near unexpected token `)'
>
> although the line looks correct --- when I highlight it and 'send',
> it works.

bash/readline does not know what you click on -- it still thinks you are typing at the end of line.

Enabling cooked mode (middle-click -> 'cook', probably along with `stty -echo`) can help -- it makes 9term only send an entire line at once -- but it may create some other problems.

--
Mantas Mikulėnas (0xD24F6CB2C1B52632)



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

* Re: [9fans] p9p 9term problem
  2011-01-26 16:05 ` Mantas Mikulėnas
@ 2011-01-26 21:12   ` Rudolf Sykora
  2011-01-27  1:37   ` Russ Cox
  1 sibling, 0 replies; 6+ messages in thread
From: Rudolf Sykora @ 2011-01-26 21:12 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> bash/readline does not know what you click on -- it still thinks you are typing at the end of line.
> Mantas Mikulėnas (0xD24F6CB2C1B52632)

Aha! Thanks for the explanation. I completely 'missed' that readline
reads as I type...
Now it makes some sense.
R



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

* Re: [9fans] p9p 9term problem
  2011-01-26 16:05 ` Mantas Mikulėnas
  2011-01-26 21:12   ` Rudolf Sykora
@ 2011-01-27  1:37   ` Russ Cox
  2011-01-27  7:48     ` smiley
  1 sibling, 1 reply; 6+ messages in thread
From: Russ Cox @ 2011-01-27  1:37 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> Enabling cooked mode (middle-click -> 'cook', probably
> along with `stty -echo`) can help -- it makes 9term only
> send an entire line at once -- but it may create some other problems.

A better way to do this is to leave 9term in nocook mode
(meaning the menu says cook - just don't click on it).
As long as you execute (for bash)

    set +o emacs
    set +o vi

to turn off those editing modes, bash will just read from the
tty with echo turned on, and if echo is turned on 9term will
let you do mouse editing and deliver the lines one line at
a time.

Even better, at least for acme users, is that win works with
stty echo turned on too.  In fact it works better.  It does the
echo cancellation internally (if it sees echoing coming back
it just doesn't print it) and automatically erases typing after
a prompt like

    Password:

so you can run ssh or sudo in a win window without fear
of displaying your password for all to see.

This is all as of mid-October 2010.  If you haven't updated
since then you might want to.

Russ


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

* Re: [9fans] p9p 9term problem
  2011-01-27  1:37   ` Russ Cox
@ 2011-01-27  7:48     ` smiley
  2011-01-27 16:21       ` Russ Cox
  0 siblings, 1 reply; 6+ messages in thread
From: smiley @ 2011-01-27  7:48 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Russ Cox <rsc@swtch.com> writes:

>     set +o emacs
>     set +o vi
>
> to turn off those editing modes, bash will just read from the
> tty with echo turned on

Is that to say that readline turns echo off when typing?

If, for example, the emacs keybindings are set, there may be another way
to insert that initial parenthesis: ^A ( ^E

Wouldn't that work, too?

But I might call more of a workaround than a fix.



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

* Re: [9fans] p9p 9term problem
  2011-01-27  7:48     ` smiley
@ 2011-01-27 16:21       ` Russ Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Russ Cox @ 2011-01-27 16:21 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>>     set +o emacs
>>     set +o vi
>>
>> to turn off those editing modes, bash will just read from the
>> tty with echo turned on
>
> Is that to say that readline turns echo off when typing?

yes.

> If, for example, the emacs keybindings are set, there may be another way
> to insert that initial parenthesis: ^A ( ^E
>
> Wouldn't that work, too?

yes but the original poster asked to be able
to use 9term's mouse editing.  if you want
^A ( ^E then my advice does not apply.

russ


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

end of thread, other threads:[~2011-01-27 16:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 12:21 [9fans] p9p 9term problem Rudolf Sykora
2011-01-26 16:05 ` Mantas Mikulėnas
2011-01-26 21:12   ` Rudolf Sykora
2011-01-27  1:37   ` Russ Cox
2011-01-27  7:48     ` smiley
2011-01-27 16:21       ` Russ Cox

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 NNTP newsgroup(s).