[comp.emacs] uEmacs 3.10 and $readhook

jrl@images1.Waterloo.NCR.COM (john Latala) (08/02/90)

I had two things that I wanted to do and couldn't come up with a way to
do them. They are both related in that I would like a uEmacs macro to
run on a buffer AFTER the text has been read in.

In the first case I wanted to use uEmacs sort of like sed. I had a macro
that I wanted run on a file but I didn't want uEmacs to come to the
keyboard when it was running it. 

My initial thought was to change the emacs.rc file used at startup. The
problem with this is that the buffer that will hold the text hasn't been
created and there's no text!

I couldn't find an easy way around this so I did it another way.

The second thing that I wanted was to use an edit date/time stamp in a
file. When a file is opened it would search for some unique string,
something like:

		EditTimeStamp: [Thu Aug  2 12:42:43 EDT 1990]

The macro would check for the string 'EditTimeStamp: [' then if it was
found replace the time/date between the square brackets with the current
time/date.

Writing the macro was no problem, getting it to execute was. If you bind
it to $readhook there is no text in the buffer when the macro is
written! If you bind it to $bufhook then the macro gets run whenever you
change buffers!

Is there a way to get a macro to run in uEmacs 3.10 AFTER a buffer has
been created and the text written into it, but before the user can get
their hands on it?

----------------------------------------

While I was just typing this in I thought that maybe you could have the
$readhook macro set the $cmdhook value. When a buffer is created and
filled uEmacs will call $cmdhook just before it needs a user command.

The $cmdhook macro can then do what it needs to do then clear the value
of $cmdhook back to a null value (nop). 

This might work, but it's not nice. Especially if you are already using
the $cmdhook for something else.....
--
john.Latala@Waterloo.NCR.COM