9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Daniel Peyrolon <tuchalia@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] Acme, Edit, code and newline
Date: Mon, 31 Mar 2014 17:20:46 +0200	[thread overview]
Message-ID: <CA+yaQw_t30zbXjYOjyrs6WfU6L5Uu98W3xSqBhc=tz+FSA9uvA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1714 bytes --]

             reply	other threads:[~2014-03-31 15:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-31 15:20 Daniel Peyrolon [this message]
2014-03-31 15:36 ` Mark van Atten
2014-03-31 15:39   ` erik quanstrom
2014-03-31 15:44     ` Mark van Atten
2014-03-31 15:46       ` erik quanstrom
2014-03-31 15:54   ` Daniel Peyrolon
2014-03-31 16:23     ` Ruben Schuller
2014-04-01  7:24     ` Mark van Atten
2014-04-01  8:23       ` Daniel Peyrolon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+yaQw_t30zbXjYOjyrs6WfU6L5Uu98W3xSqBhc=tz+FSA9uvA@mail.gmail.com' \
    --to=tuchalia@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).