Re: Suggestion for TPU: revert

From: John Powers (john.powers_at_airwidesolutions.com)
Date: 11/01/04


Date: 1 Nov 2004 06:24:12 -0800

Sorry I keep replying to my own postings, but I am getting a lot of
good input from some off-line lurkers, that I think ought to be
distributed.

A more elegant solution to my original problem of the unmapped
MAIN window has been offered. Instead of using the raw native TPU
command "delete (current_buffer)", I can use the EVE-supplied
procedure "eve$delete_buffer". This procedure does the work for
you. It ensures that the main window is not left hanging, so you
don't have to mess around with eve$check_bad_window. It also has
another advantage. If the buffer was modified, it will also ask
'are you sure about deleting the buffer' and requires a 'D'
to delete before continuing. You have an opportunity to quit the
revert command if you hit the wrong key, and don't want to lose
all your work!

eve$delete_buffer has a second parameter, value TRUE or FALSE,
meaning "Do you want to update your SHOW buffer?". We don't
care in this case - so, in its 3rd metamorphosis, here is the
final imago for eve_revert..

procedure eve_revert

local the_file;
the_file := get_info(current_buffer,"file_name");
if eve$delete_buffer (current_buffer, FALSE)
then
  eve_get (the_file);
endif;

endprocedure;

- and I hope my contribution to this thread is finally at an
end.

- Cheers, John xx

john.powers@airwidesolutions.com (John Powers) wrote in message news:<6e87f23f.0410290900.3df500ab@posting.google.com>...
> After a brief off-line discussion with another TPUser, I need
> to modify my last entry..
>
> He emailed me saying my code didn't work! I said it did and I
> had tested it. He said it didn't and he had tested it..
>
> Further testing showed that whilst it works fine on my heavily
> customised, personalised (brutalised) TPU section, it does not
> work with the straight-out-of-the-box unaltered EVE$SECTION.
>
> The problem is that the EVE_GET command is very paranoid about
> checking if the current window is properly mapped, and if not,
> it refuses to work. As we have deleted the current buffer, the
> current window is not mapped.
>
> The fix is to use EVE's bad window check procedure entitled
> 'eve$check_bad_window' after deleting the buffer, and before
> re-getting the file. This works always - we are both agreed.
>
>
> Here is the amended version with the extra line (I still don't
> like the name REVERT, but I'll leave that as it is.
>
>
> procedure eve_revert
>
> local the_file;
> the_file := get_info(current_buffer,"file_name");
> delete (current_buffer);
> eve$check_bad_window;
> eve_get (the_file);
>
> endprocedure;
>
> - Cheers, John
>
>
> john.powers@airwidesolutions.com (John Powers) wrote in message news:<6e87f23f.0410280156.70d520f7@posting.google.com>...
> > JF Mezei <jfmezei.spamnot@teksavvy.com> wrote in message news:<418053A2.92BB2800@teksavvy.com>...
> > > John Vottero wrote:
> > > > TPU is a programming language. EVE is an editor written in TPU. You
> > > > probably have the source code for EVE in SYS$EXAMPLES: , take a look at
> > > > EVE$FILE.TPU and you can see how GET works and use that as a base for your
> > > > own REVERT.
> > >
> > > That mentality is what led Linux Torvalds to write his own too.
> > >
> > > If we want VMS to succeed, it si the default vanilla VMS that must be
> > > improved. Just adding a *** of paper that says "here is VMS, now spend mega
> > > hours writing your own basic features that come by defaylt with competing OS"
> > > isn't good enough.
> >
> > Although there is validity in this point in general, I don't like it in
> > this particular case. There is the converse argument to this point.
> > Including loads of extra bells and whistles, in order to add every
> > possible add-on, to give features that maybe one customer in a thousand
> > will want to use once every 2 years, to save a few seconds going the
> > long way, - this runs the risk bloating up the software like an
> > oversized blimp, in Micros**t style.
> >
> > In the real world, how many people would use this feature sufficiently
> > often to make it worth-while for Dec to include it? One of the best
> > features of EVE, is its extendablity. Being written in TPU with fully
> > open source, you can add on the code to do this yourself, if you decide
> > you would want to use it a lot.
> >
> > And your example here is exceptionally easy. I wrote the following piece
> > of code to do what you want in less then 3 minutes (literally - I used
> > a stopwatch!)
> >
> > procedure eve_revert
> >
> > local the_file;
> > the_file := get_info(current_buffer,"file_name");
> > delete (current_buffer);
> > eve_get (the_file);
> >
> > endprocedure;
> >
> > If you use this regularly, you can extend eve and save the extended
> > section, and it is there for you for ever. And other sites who never
> > want this won't have it filling up their TPU sections - so everybody is
> > happy!
> >
> > One additional point here. I don't like the name 'revert', I think you
> > need a better verb. One of the (IMO) really good features of the EVE
> > commands, is that they adhered to the unofficial (undocumented?)
> > standard used in DCL of ensuring that all command verbs are uniquely
> > defined by their first 4 letters, so you can abbreviate them. REVERT, is
> > going to clash with REVERSE (the command attached to the edt-kp5 command
> > to set the normal direction to reverse).
> >
> > Cheers, John