9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] edit -- a new acme(4) file
@ 2006-11-12  0:39 Arvindh Rajesh Tamilmani
  2006-11-14 18:56 ` Sascha Retzki
  0 siblings, 1 reply; 6+ messages in thread
From: Arvindh Rajesh Tamilmani @ 2006-11-12  0:39 UTC (permalink / raw)
  To: 9fans

A quick-and-dirty patch to acme that introduces 'edit', a new acme(4)
file, to which Edit commands can be written.  With this,

        echo -n ',d' >/mnt/acme/$winid/edit

would delete the window's content.  I am planning to port this to Acme
SAC, so that I can write acme scripts that don't depend on sed/ed,
which are only partially implemented in Inferno.

Comments welcome.
Thanks.
Arvindh

acme-sources/dat.h:14,19 - acme/dat.h:14,20
  	QWbody,
  	QWctl,
  	QWdata,
+ 	QWedit,
  	QWeditout,
  	QWerrors,
  	QWevent,
diff -c acme-sources/fsys.c acme/fsys.c
acme-sources/fsys.c:80,85 - acme/fsys.c:80,86
  	{ "body",		QTAPPEND,	QWbody,		0600|DMAPPEND },
  	{ "ctl",		QTFILE,		QWctl,		0600 },
  	{ "data",		QTFILE,		QWdata,		0600 },
+ 	{ "edit",		QTFILE,		QWedit,		0200 },
  	{ "editout",	QTFILE,		QWeditout,	0200 },
  	{ "errors",		QTFILE,		QWerrors,		0200 },
  	{ "event",		QTFILE,		QWevent,		0600 },
diff -c acme-sources/xfid.c acme/xfid.c
acme-sources/xfid.c:110,116 - acme/xfid.c:110,119
  			break;
  		case QWdata:
  		case QWxdata:
+ 		case QWedit:
  			w->nopen[q]++;
+ 			seq++;
+ 			filemark(t->file);
  			break;
  		case QWevent:
  			if(w->nopen[q]++ == 0){
acme-sources/xfid.c:215,226 - acme/xfid.c:218,230
  			break;
  		case QWdata:
  		case QWxdata:
+ 		case QWedit:
  			w->nomark = FALSE;
  			/* fall through */
  		case QWaddr:
  		case QWevent:	/* BUG: do we need to shut down Xfid? */
  			if(--w->nopen[q] == 0){
- 				if(q == QWdata || q == QWxdata)
+ 				if(q == QWdata || q == QWxdata || q == QWedit)
  					w->nomark = FALSE;
  				if(q==QWevent && !w->isdir && w->col!=nil){
  					w->filemenu = TRUE;
acme-sources/xfid.c:423,428 - acme/xfid.c:427,445
  			break;
  		}
  		w->addr = a;
+ 		fc.count = x->count;
+ 		respond(x, &fc, nil);
+ 		break;
+
+ 	case QWedit:
+ 		x->data[x->count] = 0;
+ 		r = bytetorune(x->data, &nr);
+ 		t = &w->body;
+ 		wincommit(w, t);
+ 		if(w->nomark == FALSE)
+ 			seq++;
+ 		editcmd(t, r, nr);
+ 		free(r);
  		fc.count = x->count;
  		respond(x, &fc, nil);
  		break;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] edit -- a new acme(4) file
  2006-11-12  0:39 [9fans] edit -- a new acme(4) file Arvindh Rajesh Tamilmani
@ 2006-11-14 18:56 ` Sascha Retzki
  2006-11-14 19:56   ` Arvindh Rajesh Tamilmani
  2006-11-14 20:11   ` Arvindh Rajesh Tamilmani
  0 siblings, 2 replies; 6+ messages in thread
From: Sascha Retzki @ 2006-11-14 18:56 UTC (permalink / raw)
  To: 9fans

> A quick-and-dirty patch to acme that introduces 'edit', a new acme(4)
> file, to which Edit commands can be written.
[...]
>
> Comments welcome.

*Arrr* I love it. Always wanted an edit-file, makes acme even more powerful. patch(1) :-D ?

> I am planning to port this to Acme
> SAC

Excuse me, What's 'Acme SAC'? Did I miss something? Is it a internet-acronym I never heared of?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] edit -- a new acme(4) file
  2006-11-14 18:56 ` Sascha Retzki
@ 2006-11-14 19:56   ` Arvindh Rajesh Tamilmani
  2006-11-15 18:33     ` Sascha Retzki
  2006-11-14 20:11   ` Arvindh Rajesh Tamilmani
  1 sibling, 1 reply; 6+ messages in thread
From: Arvindh Rajesh Tamilmani @ 2006-11-14 19:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> Excuse me, What's 'Acme SAC'? Did I miss something?
> Is it a internet-acronym I never heared of?

Acme SAC is Caerwyn's stand alone Acme, based on Inferno.

http://www.caerwyn.com/acme
http://code.google.com/p/acme-sac

Quite useful when you are stuck in a Windows-only environment, like me.

Arvindh


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] edit -- a new acme(4) file
  2006-11-14 18:56 ` Sascha Retzki
  2006-11-14 19:56   ` Arvindh Rajesh Tamilmani
@ 2006-11-14 20:11   ` Arvindh Rajesh Tamilmani
  2006-11-14 22:06     ` Russ Cox
  1 sibling, 1 reply; 6+ messages in thread
From: Arvindh Rajesh Tamilmani @ 2006-11-14 20:11 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 11/14/06, Sascha Retzki <sretzki@gmx.de> wrote:
> > A quick-and-dirty patch to acme that introduces 'edit', a new acme(4)
> > file, to which Edit commands can be written.
> [...]
> >
> > Comments welcome.
>
> *Arrr* I love it.

Thanks :-)

> patch(1) :-D ?

I haven't fully understood acme control files :-)
Don't see the point of wrsel and rdsel -- the functionality can be
easily achieved using other files.  Yet to figure out the use of
/mnt/acme/editout -- managed to crash acme using this though :-)

Arvindh


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] edit -- a new acme(4) file
  2006-11-14 20:11   ` Arvindh Rajesh Tamilmani
@ 2006-11-14 22:06     ` Russ Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Russ Cox @ 2006-11-14 22:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

rdsel, wrsel, and editout are only for acme's own use
when running external commands.

Try opening a new window, highlight some text in it,
and then run each of:
  |cat /proc/$pid/fd
  Edit |cat /proc/$pid/fd

Russ


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] edit -- a new acme(4) file
  2006-11-14 19:56   ` Arvindh Rajesh Tamilmani
@ 2006-11-15 18:33     ` Sascha Retzki
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Retzki @ 2006-11-15 18:33 UTC (permalink / raw)
  To: 9fans

>
> Quite useful when you are stuck in a Windows-only environment, like me.
>

Awesome, you made my day - thanks :-)



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-11-15 18:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-12  0:39 [9fans] edit -- a new acme(4) file Arvindh Rajesh Tamilmani
2006-11-14 18:56 ` Sascha Retzki
2006-11-14 19:56   ` Arvindh Rajesh Tamilmani
2006-11-15 18:33     ` Sascha Retzki
2006-11-14 20:11   ` Arvindh Rajesh Tamilmani
2006-11-14 22:06     ` Russ Cox

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).