From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 1 Apr 2014 10:23:34 +0200 Message-ID: From: Daniel Peyrolon To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=047d7bf166ea529c9004f5f6e253 Subject: Re: [9fans] Acme, Edit, code and newline Topicbox-Message-UUID: d421ca18-ead8-11e9-9d60-3106f5b1d025 --047d7bf166ea529c9004f5f6e253 Content-Type: text/plain; charset=ISO-8859-1 Hi there everyone, Many thanks for the explanation, it's much clearer now. 2014-04-01 9:24 GMT+02:00 Mark van Atten : > On Mon, Mar 31, 2014 at 5:54 PM, Daniel Peyrolon > wrote: > >> Edit , x/^[^ ]+[ ]*[^(]*\([^)]*\)[ ]*\{[ ]*\n/ s/[ ]*\{[ ]*\n/\n\{/g > > > > So, it was simply a matter of changing "$" for "\n" at the x command! > > Yes. (In the version I gave, the replacement of the second $, the one > in the s command, by \n was superfluous.) > > > How come my command didn't work? > > It really should work with the "$", shouldn't it? > > In the original version, the x command matches up to the end of the > line, but the resulting selection is no longer itself a line; so the > subsequent s command, trying to match various things and then the > empty string at the end of a line ($), does not succeed. > > But replacing, in the x command, the $ by \n leaves the result of a > match (now one character longer because it includes the \n) a line, in > which the s command then successfully matches $. > > As ever, > Mark. > > -- Daniel --047d7bf166ea529c9004f5f6e253 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi there everyone,

Many thanks for the = explanation, it's much clearer now.


2014-04-01 9:24 GMT+02:00 Mark van At= ten <vanattenmark@gmail.com>:
On Mon, Mar 31, 2014 at 5:54= PM, Daniel Peyrolon <tuchalia@gma= il.com> wrote:
>> Edit , x/^[^ ]+[ ]*[^(]*\([^)]*\)[ ]*\{[ ]*\n/ s/[ ]*\{[ ]*\n/\n\{= /g
>
> So, it was simply a matter of changing "$" for "\n"= ; at the x command!

Yes. (In the version I gave, the replacement of the second $, the one=
in the s command, by \n was superfluous.)

> How come my command didn't work?
> It really should work with the "$", shouldn't it?

In the original version, the x command matches up to the end of the line, but the resulting selection is no longer itself a line; so the
subsequent s command, trying to match various things and then the
empty string at the end of a line ($), does not succeed.

But replacing, in the x command, the $ by \n leaves the result of a
match (now one character longer because it includes the \n) a line, in
which the s command then successfully matches $.

As ever,
Mark.




--
Daniel
--047d7bf166ea529c9004f5f6e253--