jEdit Community - Resources for users of the jEdit Text Editor
SideKick and edit modes
Submitted by shlomy on Tuesday, 10 October, 2006 - 07:07
My plugin, CtagsSideKick, registers itself as a SideKick parser (named 'ctags') for edit modes c, c++ and java using the lines below. If I open the "Parsers" page in the SideKick plugin options, I indeed see my plugin being used as the parser for these modes, and if I open files with extensions ".c", ".cpp" and ".java", I see that SideKick uses my plugin to generate the tree. However, when I open files with ".h" extension, no parser is selected, and the tree doesn't appear. I need to manually select 'ctags' in order to see the tree. Using the menu "Utilities -> Global Options -> Editing", I see that ".h" files are associated with the c++ mode. Yet my plugin is not used for ".h" files by default. Am I missing something, or is this a SideKick bug?

Following are the lines I use to register my plugin with SideKick:
sidekick.parser.ctags.label=ctags
mode.c.sidekick.parser=ctags
mode.c++.sidekick.parser=ctags
mode.java.sidekick.parser=ctags
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
SideKick issue resolved
by shlomy on Tue, 10/10/2006 - 07:23
Jokes on me - I just noticed that the jEdit status bar displays the edit mode of the current buffer. Turns out that ".h" files were associated with the "objective-c" edit modes, this explains why my plugin parser was not used with such files by default. As soon as I removed the association between "objective-c" and ".h" files, the "c++" association started to work and my plugin is now used by default for ".h" files.

This brings me to the following question: If the same file extension may be used by several modes, how does jEdit pick the mode and is there an option to specify the default mode (of all matching modes) to be used for an extension? In my case, I removed the objective-c association, but it would be more correct to keep it and instead specify c++ as the default.
 
not a feature yet
by Robert Schwenn on Tue, 10/10/2006 - 21:50
Hi shlomy,

the concept is: jedit chooses an extension-dependent editmode for a buffer. If You want another You can choose it from a list of ALL other modes in the buffer options dialog.

So I think it makes no sense to assign a file extension to more than one editmodes, because such a list is not maintained at all. It should be a mistake in the catalog file.

Robert
 
It's okay to have several edit modes for the same extension
by shlomy on Wed, 11/10/2006 - 06:09
After all, an edit mode handles files of the language after which it is named. ".h", for example, is a common file extension for both C, C++ and Objective-C (and maybe more). So I don't have a problem with the same extension being used by several modes.

I am aware of the option to change the mode for the current buffer using Buffer Options. But this only affects the current buffer. What I wish is that jEdit maintained a list of "default edit mode" for each file extension, which would be available in Global Options, where I can add file extensions and specify the default modes for handling them.
 
List of modes for each extension?
by Robert Schwenn on Wed, 11/10/2006 - 19:49
Well, the default mode for each extension already exists - it's the only one Eye-wink.

But if I understand You right, You want to have a list of modes for each extension and for each list a default mode (if the list has more then one item)?

However, in every case jedit can only choose one editmode for a buffer at opening. And if this is not Your desired mode You can choose another for the current buffer (and current session) - it would be the same like now. The only Difference would be, that there could be a second list of modes, call it the "prefered modes list", wich is very short and handy...

Do You think so?

Robert
 
Explanation
by shlomy on Thu, 12/10/2006 - 08:42
I don't really understand what you mean in the sentence "The only Difference would be...". I'll explain what I meant:
In addition to the current way jedit handles mode, I suggest to add yet another list where the user can select the mapping between extensions and modes. Initially, the list will be empty, and jEdit will choose the mode for a buffer just like it does now. However, if I see that jEdit chooses 'objective-c' for ".h" files, I will be able to add ".h" -> "c++" mapping to the list, and from now on, jEdit will open ".h" files in c++ mode. That's about it. Adding an extension to the list will be the same as removing the associations from all other modes to this extension, keeping only the association of the selected mode with this extension.
So that list will simply be an "override" on the current mode-selection algorithm of jEdit.
 
winner list :-)
by Robert Schwenn on Thu, 12/10/2006 - 21:18
Changing the settings in "Utilities -> Global Options -> Editing" means that these changes are written into the "properties" file (in settings directory). So the original settings (the "catalog" file in modes directory) stay unchanged - these can be reactivated by checking "use standard settings" in the option pane.

May be it's nearly what You want. But the changes cannot be made very directly: Because only one of several associations "wins", You might have to remove the assosiation that You want to override. -- And now I think I understand Your goal. You want to have a separate list of associations, that wins in every case Smiling - allright?
 
Yes
by shlomy on Sun, 15/10/2006 - 08:15
It is definitely easier to add an association to the "winner list" than to start looking for all modes that handle an extension and remove them. Actually a nice GUI for the "winner" list would be to make the status bar string specifying the current edit mode a combo-box so you can click on it and select the "winner mode" for the extension of the current buffer from it. No options, no dialogs, simple combo box. (Though I don't know how difficult it is to implement such a GUI and whether this GUI would be good for most users.)
 
Now that we agree You may bet
by Robert Schwenn on Sun, 15/10/2006 - 15:18
Now that we agree You may better post it as a feature request - hoping for more response.

The status bar shows and toggles only settings for the current buffer. I'm not sure if this is the rigt place for a global setting.
User login
Browse archives
« March 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
31
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   82338
Context Free Art (*.cfdg)   0.31   46042
JBuilder scheme   .001   18487
BBEdit scheme   1.0   18107
ColdFusion scheme   1.0   18015
R Edit Mode - extensive version   0.1   17461
Advanced HTML edit mode   1.0   16194
Matlab Edit Mode   1.0   16056
jEdit XP icons   1.0   15220
XP icons for jEdit   1.1   14281