Re: [9fans] acme: send dot to the stdin of a more complicated command

2013-08-28 Thread James A. Robinson
On Wed, Aug 28, 2013 at 5:13 AM, dexen deVries wrote: > your selection lacks the final LF to make Rc happy ;-) > > a quick and dirty hack would be to always append LF: > exec /usr/local/plan9/bin/rc <{9p read acme/$id/rdsel;echo;} > > tested with: > echo foo bar > rc <{9p read acme/$winid/rdsel; e

Re: [9fans] acme: send dot to the stdin of a more complicated command

2013-08-28 Thread Rudolf Sykora
On 28 August 2013 14:13, dexen deVries wrote: > your selection lacks the final LF to make Rc happy ;-) > > a quick and dirty hack would be to always append LF: > exec /usr/local/plan9/bin/rc <{9p read acme/$id/rdsel;echo;} > > tested with: > echo foo bar > rc <{9p read acme/$winid/rdsel; echo; }

Re: [9fans] acme: send dot to the stdin of a more complicated command

2013-08-28 Thread dexen deVries
On Wednesday 28 of August 2013 10:05:14 Rudolf Sykora wrote: > Hello, > > I tried to modify Russ' script below to be usable on p9p. I came up with > > #!/usr/local/plan9/bin/rc > > if(! ~ $#* 1) { > echo 'usage: Run title' >[1=2] > exit 1 > } >

Re: [9fans] acme: send dot to the stdin of a more complicated command

2013-08-28 Thread Rudolf Sykora
Hello, I tried to modify Russ' script below to be usable on p9p. I came up with #!/usr/local/plan9/bin/rc if(! ~ $#* 1) { echo 'usage: Run title' >[1=2] exit 1 } id=`{awk -v 'pat='$1 '$6 ~ pat {print $1}' <{9p read acme/index}} if(~ $#id 0) {

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-09 Thread Rudolf Sykora
> See http://swtch.com/~rsc/acme-Run.png for an illustration. > > Russ Thank you much! This is what I need and now I see how it can be achieved... :) Ruda

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread Dan Cross
On Mon, Jun 8, 2009 at 2:15 PM, Russ Cox wrote: > The script below implements this usage; I called it Run. > You can type and select your command in one window, with a name matching > pattern, and then in the other window's tag execute >Run pattern. > Run finds the window with a title matching patt

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread Russ Cox
> well, though an inspiring idea, it doesn't sound to be much practical: > 1) I usually have a special window in which I have many commands. I > then select the one needed and chord it to the appropriate window > (i.e. I don't use the whole contents of a window). > 2) sometimes I have more such win

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread Rudolf Sykora
> and you want somebody do look through the code and figure it out for you? not really. I wanted to know whether 1) somebody thought about it (knowing the system has been around for some time I'd expect somebody must have had the same problem) 2) there is any good reason why it behaves so. Ruda

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread yy
2009/6/8 Rudolf Sykora : > The very question for me now is: why it behaves how it behaves, i.e > why newlines (if it's them) are problematic. > > Ruda > They are the only way Edit has to separate commands. You will notice that you cannot use something like i/A/a/W/ (or i/A/;a/W/, for example). How

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread andrey mirtchovski
> The very question for me now is: why it behaves how it behaves, i.e > why newlines (if it's them) are problematic. and you want somebody do look through the code and figure it out for you?

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread Rudolf Sykora
> remember, this is plan9 and everything is a file. chances are your > "script" is already available in some filesystem and you don't need to > write it out:: create a new window inside acme, type your awk script > and then issue ">awk -f /mnt/wsys/X/body" where X is the ID of your > window. well,

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread andrey mirtchovski
> well, I hoped this would be the last way... It makes me create files I > don't actually need. remember, this is plan9 and everything is a file. chances are your "script" is already available in some filesystem and you don't need to write it out:: create a new window inside acme, type your awk sc

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread Rudolf Sykora
> Put the awk code into a file and execute '> awk -f foo' in acme. well, I hoped this would be the last way... It makes me create files I don't actually need. Is it the newlines that causes troubles? Thanks Ruda

Re: [9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread Lyndon Nerenberg
But what shall I do when the awk script is more complicated, in the simplest case Put the awk code into a file and execute '> awk -f foo' in acme.

[9fans] acme: send dot to the stdin of a more complicated command

2009-06-08 Thread Rudolf Sykora
Hello everyone, when I want to process a dot's contents in acme I can use the '>' syntax, e.g. have > awk '{print}' in a window, select it, and then 2-1 click on Edit in the window with my dot. That works. But what shall I do when the awk script is more complicated, in the simplest case like >