9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Mark van Atten <vanattenmark@gmail.com>
To: 9fans@9fans.net
Subject: Re: [9fans] Acme Edit scriptlets
Date: Thu,  4 Apr 2013 10:19:23 +0000	[thread overview]
Message-ID: <82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com> (raw)
In-Reply-To: <CAOCRf5U1-fgQ5aRqW1dj0fPE_a0yfpWNnORu4M5j8H6rT4MzNQ@mail.gmail.com>

On Friday, 29 March 2013 01:38:06 UTC+1, Bence Fábián  wrote:

> I did a quick writeup on little Edit scripts

Many thanks, this thread is very useful.

There is also Jason Catena's list of Edit idioms at
https://raw.github.com/catenate/acme-fonts/master/test/1/acme/Edit/sam

When editing and re-editing latex, I regularly pipe selections
through a simple-minded script called `chunk' which does most of
the work for obtaining semantic linebreaks. That goes back to a
recommendation by Kernighan in his paper `Unix for beginners' of
1974; see the quotation, comments and link at [1].



#!/usr/local/plan9/bin/rc 
# chunk up (to prepare) for semantic linebreaks

# do  not break within \cite 
# do not break within $$ math 
# break after closing parentheses ),] 
# break before an opening parentheses (,[

ssam -e 'x/(^[^%].+\n)+/  y/\\cite[^{]*{(\n|.)*}/ y/\$.*\$/
x/(([^A-Z]\.)|[,;:!?]|\)|\]) | (\(|\[)/ s/ /\n/' \ | 9 fmt -w 60
-j


For batch processing probably something more sophisticated would
be needed to leave various environments unchunked. But I don't use
it that way, and just apply it to selections where I know its use
makes sense. Usually these are areas where I have just been doing
a lot of rewriting.

There's no point in chunking up commented material, and sometimes
it is actually convenient to have a place where I can keep things
unchunked for reference.

The original chunk command in Writer's Workbench [2], for troff not
latex, was  based on a parser for English, I think. I find I don't
want that (because I write in other languages as well), and that
even in English I don't need it (because the chunking based on
interpunction is always fine with me, and where I care about the
remaining cases, I prefer to do it myself; but see [3]).

Mark.


[1] http://rhodesmill.org/brandon/2012/one-sentence-per-line/

[2] http://man.cat-v.org/unix_WWB/1/chunk

[3] https://github.com/waldir/semantic-linebreaker



  parent reply	other threads:[~2013-04-04 10:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29  0:38 Bence Fábián
2013-03-29  1:19 ` phineas.pett
2013-03-29  8:22   ` Peter A. Cejchan
2013-03-29  8:20 ` dexen deVries
2013-03-29  8:25   ` Peter A. Cejchan
2013-03-29  8:48     ` dexen deVries
2013-03-29  9:50   ` Richard Miller
2013-03-29 16:20     ` Skip Tavakkolian
2013-04-04 10:19 ` Mark van Atten [this message]
2013-04-04 12:08   ` dexen deVries
2013-04-04 12:16   ` Bence Fábián
2013-04-04 12:28     ` erik quanstrom
2013-04-04 13:01       ` Bence Fábián
2013-04-04 13:04         ` [9fans] Acme script request (was: Acme Edit scriptlets) dexen deVries
2013-04-04 13:17           ` Bence Fábián
2013-04-05 12:35             ` Martin Kühl
2013-04-05 12:50               ` dexen deVries
2013-04-05 12:32         ` [9fans] Acme Edit scriptlets David Arroyo

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=82380754-4ab1-4c31-b696-0b9c604ec2c9@googlegroups.com \
    --to=vanattenmark@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).