From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 Date: Mon, 31 Mar 2014 17:20:46 +0200 Message-ID: From: Daniel Peyrolon To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=047d7b670833874a2004f5e898ed Subject: [9fans] Acme, Edit, code and newline Topicbox-Message-UUID: d39113d8-ead8-11e9-9d60-3106f5b1d025 --047d7b670833874a2004f5e898ed Content-Type: text/plain; charset=ISO-8859-1 Hi there, I'm using p9p's acme, and I would like to take a piece of code and change, for example this: int main(int argc, char *argv[]) { For this: int main(int argc, char *argv[]) { So, for doing that, I thought about using some regexps and the Edit command. I would like to work with some generic regexp, so I wrote the following: Edit , x/^[^ ]+[ ]*[^(]*\([^)]*\)[ ]*\{[ ]*$/ s/[ ]*{[ ]*$/\n{/g By the man, the x command, under sam(1) does execute the command after the x. Also, we have to use \n, instead of a real newline. AFAICT, these two commands work, separatedly. Using the first one prints me the whole set of function definitions, and using the s// when selecting the line that holds something like: blah blah (blah blah) { Does indeed change that for: blah blah (blah blah) { But when used together, this command doesn't work. Could please someone provide me with some insight on why this doesn't work? Thanks a lot. (Sorry for the blah) -- Daniel --047d7b670833874a2004f5e898ed Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi there,

I'm using p9p's acme,= and I would like to take a piece of code and change, for example this:

int main(int argc, char *argv[]) {

For this:

int main(int argc, char *argv[])
{

So, for doing that, I thought about usin= g some regexps and the Edit command.

I would like = to work with some generic regexp, so I wrote the following:

Edit , x/^[^ ]+[ ]*[^(]*\([^= )]*\)[ ]*\{[ ]*$/ s/[ ]*{[ <= /span>]*$/\n{/g

By the man, the x command, under sam(1) does execute th= e command after the x. Also, we
have to use \n, instead of a real= newline.

AFAICT, these two commands work, separat= edly. Using the first one prints me the whole
set of function definitions, and using the s// when selecting the line= that holds something like:

blah blah (blah blah) = {

Does indeed change that for:
blah blah= (blah blah)
{

But when used together, this command doesn&= #39;t work. Could please someone provide=A0
me with some insight = on why this doesn't work? Thanks a lot.

(Sorry= for the blah)

--
Daniel
--047d7b670833874a2004f5e898ed--