Default edit mode for specific file extensions
Submitted by Sunday, 15 October, 2006 - 22:23
on
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...
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...