(if you're wondering what you're doing here, jed is a hardcore text based editor for programmers)
Thanks to fellow Jed user and hacker Ullrich Horlacher I can now have local settings per directory.
I personally prefer 2 spaces in my Javascript. And thankfully most projects I work on agrees with that standard. However, I have one Mozilla project I work on which uses 4 spaces for indentation. So, what I've had to get used to to is to edit my ~/.jedrc
every time I switch to work on that particular project. I change: variable C_INDENT = 2;
to variable C_INDENT = 4;
and then back again when switching to another project.
No more of that. Now I just add a file into the project root like this:
$ cd dev/airmozilla $ cat .jed.sl variable C_INDENT = 4;
And whenever I work on any file in that tree it applies the local override setting.
Here's how you can do that too:
First, put this code into your <your jed lib>/defaults.sl
: (on my OSX, the jed lib is /usr/local/Cellar/jed/0.99-19/jed/lib/
)
% load .jed.sl from current or parent directories % but only if the user is the same define load_local_config() { variable dir = getcwd(); variable uid = getuid; variable jsl,st; while (dir != "/" and strlen(dir) > 1) { st = stat_file(dir); if (st == NULL) return; if (st.st_uid != uid) return; jsl = dir + "/.jed.sl"; st = stat_file(jsl); if (st != NULL) { if (st.st_uid == uid) { pop(evalfile(jsl)); return; } } dir = path_dirname(dir); } }
Then add this to the bottom of your ~/.jedrc
:
define startup_hook() { load_local_config(); % .jed.sl }
Now, go into a directory where you want to make local settings, create a file called .jed.sl
and fill it to your hearts content!