jEdit Community - Resources for users of the jEdit Text Editor
Default edit mode for specific file extensions
Submitted by shlomy on Sunday, 15 October, 2006 - 22:23
Today, edit modes declare the file extensions they handle. The same file extension may be specified for several edit modes, and it's okay. For example, '.h' files can be both C, C++, or Objective-C files. So far, this is natural and good.

When the user opens a buffer, jEdit selects the first edit mode that can handle the extension of the buffer and uses it. Sometimes, this is not the mode that the user wanted to use. For example, I opened a file "a.h", and it was opened in Objective-C mode, but I never program in Objective-C, only C++. So I have two options:
1. Use the "buffer options" to change the mode for the current file ("a.h"). This means that if I then open "b.h", it will again open in Objective-C mode and I will have to change it as well.
2. Use the "global options" to remove the association between Objective-C and ".h" files (and I might need to do this for other modes handling ".h" files as well except C++). This means that all ".h" files that I open from now on will be opened in C++ mode, but: a) I had to do some work (remove the associations from all other modes), and b) if at some point I'm going to use Objective-C, I will need to add the association again.

I suggest to add the following feature to jEdit: A "default modes" list, where the user can specify for specific extensions which modes he'd like to use. If an extension is not on the "default modes" list, jEdit will choose the mode just as it does now. However, if the extension is on the list, it will use the mode specified in the list. So if I see that my ".h" file was opened in Objective-C, I will simply add an association from ".h" to "C++" to that list, and all future buffers of ".h" files will use C++ mode.

Furthermode, I suggest a user-friendly GUI to support this list: In the status bar, the text string specifying the current edit mode will be replaced by a combo box. If the mode used for the buffer is not the desired one, the user will be able to select the desired one from the combo box and the mode selected will be set automatically as the default mode for this extension (i.e. automatically add to the "default modes" list or automatically update it).

Feedback will be most welcome...
User login
Browse archives
« September 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   96034
Context Free Art (*.cfdg)   0.31   46061
BBEdit scheme   1.0   18600
JBuilder scheme   .001   18501
ColdFusion scheme   1.0   18030
R Edit Mode - extensive version   0.1   17480
Advanced HTML edit mode   1.0   16212
Matlab Edit Mode   1.0   16074
jEdit XP icons   1.0   15235
XP icons for jEdit   1.1   14299