|
From: Patrick W. <jed...@pd...> - 2004-06-28 14:52:02
|
Max
Here is a BeanShell script you can try.
Note that if you open a file, but do nothing with it, this script will
close it if the file was not modified in the last 5 minutes...that is, if
you open a file you edited even an hour or fifteen minutes ago, then run
this script, it will be closed. I can't find any var in JEdit that tells
us when a file was last opened in JEdit, so the only timestamp we have is
the last time it was saved to disk.
Dirty files will be left open.
The file(exists) check is for new unsaved buffers.
closeOld() {
age =3D 1000 * 60 * 5; // 5 min
cutoff =3D System.currentTimeMillis() - age;
buffers =3D jEdit.getBuffers();
for ( i=3D0; i < buffers.length; i++ ) {
buffer =3D buffers[i];
file =3D new File(buffer.getPath());
if ( !file.exists() ) continue;
lastMod =3D file.lastModified();
if ( lastMod > cutoff || buffer.isDirty()) continue;
jEdit.closeBuffer(view, buffer);
}
}
closeOld();
patrick
> Hello,
>
> When I am coding, at some point I have 10-20 buffers open but only 3-4
> of them are actively used. The others are usually opened to check an
> error of a function definition etc.
>
> I wonder if it would be possible to write a macro/plugin/core-feature
> which could close the files which are
>
> - not edited since 5 minutes or
> - not brought to front for the last 5 minutes
>
> I believe this would be very convenient for programmers like me.
> Currently I have to manually select and close each file.
>
> Ideas ?
>
> Max.
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> digital self defense, top technical experts, no vendor pitches,
> unmatched networking opportunities. Visit www.blackhat.com
> --
> -----------------------------------------------
> jEdit Users' List
> jEd...@li...
> https://lists.sourceforge.net/lists/listinfo/jedit-users
>
|