GNOME Bugzilla – Bug 610429
Modelines plugin: Case sensitivity for keys
Last modified: 2019-03-23 20:33:52 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.
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?
Created attachment 154485 [details] [review] Updated patch
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.
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
Created attachment 154541 [details] [review] Updated patch Updated according to comments. Thanks for your interest and guidance!
Committed. Thanks!