After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 610429 - Modelines plugin: Case sensitivity for keys
Modelines plugin: Case sensitivity for keys
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2010-02-19 07:17 UTC by Holger Berndt
Modified: 2019-03-23 20:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
case insensitive comparison of emacs modelines (1.92 KB, patch)
2010-02-19 07:17 UTC, Holger Berndt
none Details | Review
Updated patch (532 bytes, patch)
2010-02-23 11:06 UTC, Holger Berndt
none Details | Review
Updated patch (915 bytes, patch)
2010-02-23 20:09 UTC, Holger Berndt
none Details | Review

Description Holger Berndt 2010-02-19 07:17:30 UTC
Created attachment 154187 [details] [review]
case insensitive comparison of emacs modelines

The modelines plugin for gedit does case-sensitive key comparison. I don't know about kate or vim modelines, but emacs interprets its modelines case insensitive. I stumbled upon this as many scripts have "mode: python" or similar in the modelines, and I was wondering why gedit didn't pick it up. It only recognizes "Mode:".

I'm attaching a simple patch to fix the issue with emacs modelines. vim and kate parts are untouched.
Comment 1 Paolo Borelli 2010-02-22 21:50:26 UTC
Thanks for the patch. I was about to apply it, but some experiments showed that note all keys are case insenstive.

Beside it seems some of the values are case insesitive too :(

Can you do a bit of research about each key we support and its possible values to check if they are really case sensitive or not?
Comment 2 Holger Berndt 2010-02-23 11:06:23 UTC
Created attachment 154485 [details] [review]
Updated patch
Comment 3 Holger Berndt 2010-02-23 11:07:47 UTC
Good catch. I did indeed only test the "mode" key for case sensitivity, as that was the one bothering me.

I am not really an expert for the modelines, and I couldn't find documentation either. However, I did some tests with the recognized keys now, and the results are as follows:

mode: key and value are not case sensitive

tab-width: key is case sensitive

indent-offset: Doesn't seem to work at all for me. Offsets seem to be mode specific (py-indent-offset and friends)

indent-tabs-mode: key is case sensitive

autowrap: doesn't seem to work at all for me

As I don't know if I did something wrong with autowarp and indent-offset, or if emacs changed behaviour between versions, I am leaving them untouched. The case sensitive comparison with tab-width and indent-tabs-mode was okay, so I left it the way it was. The "mode" value is already compared case-insensitive in the plugin, so the only part remaining is the case insensitive "mode" key comparison.

I attached the updated one-liner patch.
Comment 4 Paolo Borelli 2010-02-23 11:17:41 UTC
thanks for the investigation!

Just one more tiny comment: can you add a comment like 

/* "Mode" key is case insenstive */

just above the comparison

Also, can you commit the patch in your local git repo and then send the patch with 

git format-patch HEAD^

This way you'll be properly credited in the git log
Comment 5 Holger Berndt 2010-02-23 20:09:06 UTC
Created attachment 154541 [details] [review]
Updated patch

Updated according to comments. Thanks for your interest and guidance!
Comment 6 Paolo Borelli 2010-02-23 20:28:35 UTC
Committed. Thanks!