sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
* (no subject)
@ 1993-04-13  0:16 Michael John Haertel
  1993-04-13  0:36 ` sam as a synchronous thing John Mackin
  0 siblings, 1 reply; 2+ messages in thread
From: Michael John Haertel @ 1993-04-13  0:16 UTC (permalink / raw)
  To: sam-fans

rsalz wrote:

>How do I
>tell the "editor" that I'm done editing?

This is the best solution I've come up with.

#! /bin/sh
B $1
waitforchanges $1

where "waitforchanges" is the following small C program:

#include <sys/types.h>
#include <sys/stat.h>

main(int argc, char *argv[])
{
	struct stat ost, nst;

	if (argc != 2)
		exit(1);
	if (stat(argv[1], &ost) < 0)
		exit(1);
	for (;;) {
		sleep(3);
		if (stat(argv[1], &nst) < 0)
			exit(1);
		if (nst.st_mtime != ost.st_mtime)
			break;
	}
	exit(0);
}


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

* sam as a synchronous thing
  1993-04-13  0:16 Michael John Haertel
@ 1993-04-13  0:36 ` John Mackin
  0 siblings, 0 replies; 2+ messages in thread
From: John Mackin @ 1993-04-13  0:36 UTC (permalink / raw)
  To: Sam Fans

    waitforchanges $1

Danger, Will Robinson!

Seriously, that will work in some sense but I think there are some
problems with it.  Clearly, that commits you to saying your $EDITOR
finishes the instant you write your changes out.  I have what I think
is a good habit of writing out changes to files at random times while
I'm editing.  This will totally discourage people developing that habit,
and that means they're all the more likely to lose their editing if
something goes bad.  Yes, we do have sam.save, but sam doesn't always
get a chance to do that.  I think that no matter what editor you're
using, writing out your file frequently is a good habit to have, and
one that shouldn't be discouraged.

I have some ideas for other solutions which I will send mail about
when I have thought over them some more.  They're not solid enough
to send out yet.

OK,
John.


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

end of thread, other threads:[~1993-04-13  0:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-04-13  0:16 Michael John Haertel
1993-04-13  0:36 ` sam as a synchronous thing John Mackin

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