GNOME Bugzilla – Bug 621097
Highlight Mode is not remembered with files stored on NFS
Last modified: 2014-04-06 16:52:36 UTC
In Ubuntu Lucid Imran Chaudhry reported: I have all my important files stored on an NFS share. I use the "Makefile" Highlight Mode for text files and if I set them on files that are stored on locally mounted NFS shares then that setting will be lost if I close and open the file again. I just did a test and in fact, this seems to be the case with locally stored files too. Open file, set Highlight Mode, Close file, then re-Open and Highlight Mode is lost. This worked file in the gedit on Ubuntu Karmic Koala (9.10). Launchpad ref: https://bugs.edge.launchpad.net/ubuntu/+source/gedit/+bug/584896 Thanks!
We use the metadata system provided by gio, so reassigning to them.
I think there are two factors here. Ubuntu carry a patch [1] which disables metadata on NFS. Secondly, there was an issue in gedit with metadata and *.txt files [2]. [1] http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/gvfs/trusty/view/head:/debian/patches/06_metadata_nfs.patch [2] commit 24509405d2ff541013ede6ccb879570c108914e5 Author: Sébastien Wilmet <swilmet@gnome.org> Date: Sat Nov 2 19:47:37 2013 +0100 Load highlight mode from metadata for *.txt files guess_language() is called when the content type is modified. For a *.txt file, the content type has the same value as the init value, so the notify callback is not called, and the highlight mode is not changed. To fix the problem, we also call guess_language() when the document is loaded. For other files than *.txt, guess_language() is thus called two times in loaded(): when the content type is modified (via the notify callback), and when guess_language() is called directly. But it's better two times than zero.