jEdit Community - Resources for users of the jEdit Text Editor
Need help with macro creating a new view unconnected to the current one
Submitted by tvojeho on Thursday, 15 September, 2011 - 13:36
Hi, I would like to create a macro that would close currently open buffer, open it in a new view and run another macro (*) in the new view on the buffer. The second macro often takes a minute or more, and I'd like to be able to work with the original view in the meantime. I need some help on how to create an unconnected new view with only the one buffer.

1) I have tried to use the 'View/New view' command, but it opens all the buffers in the new view which are open in the original view, no matter what bufferscope I try to set.

2) I have used macro recorder and wrote this code:

bsm = jEdit.getBufferSetManager();
if (bsm.getScope() == BufferSet.Scope.global) {
jEdit.newView(view);
}
else {
View.ViewConfig config = new View.ViewConfig();
config.docking = view.getViewConfig().docking;
jEdit.newView(view,buffer,config);
}

It opens only the current buffer in a new view, ok, but the view is still connected to the original and running the macro (*) still freezes the original view.

3) I tried launching the new view from command line with the options -newview -noserver, which worked fine to create an unconnected view, where running macro (*) did not freeze the original view, but the new view still opened all the buffers as in the original.

Any help would be appreciated. I am using the latest jedit4.5pre1 daily version.

tvojeho

P.S. I tried submitting this to jedit-users list, but my message bounced back.
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
JVM process
by Robert Schwenn on Thu, 15/09/2011 - 20:32
Hi,

2) One jEdit instance is running in one JVM process (including all jEdit Views). I'm not sure that You can have a macro working in a buffer while You work in another buffer. But You could ask at the Mailing List ( https://lists.sourceforge.net/lists/listinfo/jedit-devel ). There are the developers.

3) This works because You invoke a separate instance of jEdit, hence a second JVM in a separate process. But it's weired that the new instance opens all the buffers that are open in another jEdit instance. Maybe it's related to "Global Options -> General -> Restore previously open files on startup" ?

Robert
 
Thanks Robert, you were right
by tvojeho on Fri, 16/09/2011 - 05:35
Thanks Robert, you were right about the 'Restore previously open files on startup' option in the case 3), I ended up using the command line version with the parameters '-newview -norestore -noserver -run=script'.

By the way, is there a possibility to differenciate between the various instances of jEdit, some way to get the name of the view or server, e.g. a method like getServerName()?

tvojeho
User login
Browse archives
« November 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300