Syncing jEdit settings between machines

As I've mentioned before, I've switched to jEdit from XEmacs. I use both WinXP and Linux, and one thing that was nice about using XEmacs was that it was easy to sync my settings between machines. All I had to do was worry about two files: init.el and custom.el. Both were portable, and could be copied directly between machines.

With jEdit, though, there is an entire tree of settings. These settings live under either ~/.jedit/ on POSIX machines, or under "Documents and Settings/USERNAME/.jedit" on a Windows machine. On my Linux machine, for example, there are 104 files under ~/.jedit. It certainly appears that it will be a huge task to sync between machines. There is a "HOWTO" page, but all it really tells you is how hard it is to do. Its more discouraging than helpful, I think.

Once I dug around, though, I found I could sync two machines with a fairly simple process. There are three things that I want to sync between machines:

  1. Colors (syntax highlighting)
  2. Keyboard shortcuts
  3. Macros

Keyboard shortcuts and colors are both found in the file 'properties'. I sync it by first copying the 'properties' file from the Windows box to the Linux box, then doing the following on the Linux box:

(Assuming the two files are called ~/.jedit/properties, and ~/XFER/properties):

 

 $ grep shortcut ~/.jedit/properties | sort > P1 
$ grep shortcut ~/XFER/properties | sort > P2 
$ diff -u -b -B P1 P2 | more  

 

This pulls out all the keyboard shortcuts, in sorted order, and compares them. From here it is easy to see what needs updating. (I'm a little scared to just copy the properties file directly from one machine to another, because it looks like some OS-dependent settings are in there. The "HOWTO" page seems to discourage this as well.)

Secondly, I repeat the process for colors:

 

$ grep color ~/.jedit/properties | sort > P1 
$ grep color ~/XFER/properties | sort > P2 
$ diff -u -b -B P1 P2 | more 

 

Of course, you can also just compare the files directly like:

 

 $ sort ~/.jedit/properties > P1 
$ sort ~/XFER/properties > P2 
$ diff -u -b -B P1 P2 | more 

 

But I like to do colors & shortcuts separately, since it cuts down the size of the diff I have to read through each time. I like to do a final diff on the complete files, but I haven't found anything (so far) other than colors and keyboard settings that I want to sync.

The third thing to sync are macros. I just compare & copy ~/.jedit/macros/* to the macros/ directory on the Windows machine. I've thought about putting the macros directory under version control with darcs, but I don't write macros that often, so manual syncing is OK. jEdit rescans the macros directory each time you start it, so there are no other settings to adjust.

I've found I can just ignore all the other files under ~/.jedit. In theory, plugins can write their own settings to files other than 'properties', but so far I haven't used any that do that.

This process is still a little too much to want to do on, e.g. a daily basis, but since my settings don't change that much, I just resync either when I know I've changed something, or do just a monthly (or so) sanity check.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi, I'm trying to write

Hi, I'm trying to write scripts for translating the whole folder from Dos to Unix or the contrary. I'm using sed on choosen files. This is just the beginning, not working fully yet, but I keep the faith... Just to let you know.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.