|
From: John G. <jge...@ny...> - 2001-11-07 08:21:02
|
> -----Original Message----- > From: jed...@li... > [mailto:jed...@li...]On Behalf Of Slava > Pestov > Sent: Wednesday, November 07, 2001 1:34 AM > To: jEdit-devel Mailing List > Subject: Re: [ jEdit-devel ] Revisions to installation macros > > > On Tue, Nov 06, 2001 at 02:05:55PM -0500, John Gellene wrote: > > The CVS repository (/macros directory) now contains versions of > each of the > > macros in the installation set for version 3.2.2 that have been > updated to > > reflect changes in the jEdit API made by version 4.0. With one > exception, > > the changes all deal with deprecated methods. The exception is > that a call > > to Buffer.isReadOnly() is made as a gatekeeper anytime Buffer.insert() > > (formerly Buffer.insertString()) is called. Buffer.insert() is more > > efficient than calling methods on the text area, but it allows > changes to be > > made to a buffer representing a read-only file. > > The 4.0 Buffer.insert() now throws an Exception if you try to make changes > to a read only buffer, but it is still best to check for read > only and fail > gracefully. > > > I will write a short note for jEdit Community describing the changes, so > > that everyone will have some guidance for writing or updating their own > > macros. > > Thanks. Any chance of this becoming an appendix in the macro > guide outlining > the main changes, API-wise between jEdit 3.2 and 4.0? I was planning on > writing something like this, except for plugins. Maybe we could have a > chapter in the API Guide part about this. Do you want to write a > first draft > of this? Then I will add more information and incorporate it into > the user's > guide for 4.0pre2. Sure, that's fine. The changes that I found were necessary were (1) textArea.addSelection() instead of textArea.select(); (2) buffer.insert() instead of buffer.insertString(); (3) DockableWindowManager.getDockable() instead of getDockableWindow(). It occurs to me after doing this round of revisions that macro writers shouldn't have to deal with the DockableWindowManager class; it's an implementation detail that gets repeated over and over in macros. I suggest you provide wrappers in the View class for addDockable() and getDockable(). > > > There is also the question of reducing some bloat in the > default macro set. > > I am attaching a text file which contains my thoughts for reducing the > > current set from 39 to 26 macros and for possibly including up > to four new > > macros (all of which are available at jEdit Community). I > would appreciate > > any reactions to the proposed list or any nominations for > further additions. > > See my comments below. > > > > Tidy_Block_Comments.bsh keep > > Maybe this macro is a little to specific and specialized to go in > the core? You're right; it should go in the archive. > > > Run_Macro_at_Caret.bsh keep > > Maybe not? Maybe I'm the only one who does this, but I use this macro to have other macros work like abbreviations. It lets you do shortcuts to macros that are easier to remember. For example, I assign "bname" as an abbreviation to the relative path of a one line macro that calls Buffer.getBufferName(). I also assign C+SPACE to Run_Macro_At_Caret. Then I can type "bname", press space to expand the abbreviation, and C+SPACE to run the macro. Much easier than trying to remember whether to press A+F12 or CS+F11. I keep these shortcut macros in a separate subdirectory of the user macro directory. I would keep this one unless we are going over our limit. > > Before: 39 macros > > > > After: 26 macros Now we would be at 25 in four folders (with one subfolder for "Properties"in "Misc" > > > > New macro candidates for inclusion: > > > > Byte convert macro (rename as Hex_Convert.bsh - Text macro) > > > > Preview_JavaDoc_Of_Current_Buffer.bsh (Java macro, should > probably be a plugin > > eventually, combining features with Javadoc_Comment.bsh) > > > > Run_Perl_Script.bsh (Misc macro) > > > > Show_Threads.bsh (Misc macro) > > These all sound ok. I remember Dirk once posted a macro that emulated > the behavior of my EditBusViewer plugin (then this plugin mysteriously > disappeared from plugin central). Maybe that could be included too. I got the script thanks to Mike Dillon finding the link in the mailing list archive. I also got your later post suggesting some modifications occasioned by API changes. I will put something "nice looking" together. That would make 30 macros exactly. If you put the wrapper methods in for dockable components, I'll do another round of revisions. Then we can move the non-keepers to the CVS Attic and I'll use my local copies to post them on jEdit Community. John |