What if you want to use different JED configurations for different tasks? project.sl allows you to write a script in the current directory, or in one of its parents, where you can set variables, or do whatever you can do with slang.
I use this a lot for setting which tags files should be searched for a given program, to choose the right indentation style, etc.
The script searches for a .project.sl file (for non unix systems,
wproject.sl) in the current directory, and back in the parents, until it
finds one, reaches the root (actually until trying to change the directory back
doesn't change the current directory) or when it reaches the user's home
directory (as defined by the environment variable HOME).
If everything fails, it loads a default file (dfltprj.sl in your JED library path). As a last resort, it tries to open the file in the user-configurable variable Project_Global_File (by default it's value is NULL).
The file is executed with the variable Project_File_Dir set to the directory where the script was found.
For example, I use an indentation style all mine (a bit like linux style, but with some differences). Futhermore, my save hook strips spaces at end-of-line, and converts tabs to spaces before saving C sources. This is not what I want if I'm modifing sources written by other people, specially if I want to make diff files. So, say that I want to edit some jed files, I simply write in the jed sources' top directory a .project.sl file containing:
c_set_style("jed"); variable _Save_Remove_Tabs = 0; variable _Save_Remove_Space_At_Eols = 0; variable Tags_Files = path_concat(Project_File_Dir, "src/tags") + ",~/.tags/usr_h";And no matter how deep in the directory tree I am when I launch jed, this file will be loaded (If there are no other .project.sl files before, of course).
To use this, simply put an
() = evalfile("project"); somewhere
in your .jedrc, and write some .project.sl files in the right directories.
Back to home page.
Last Updated : Thu Nov 8 22:57:05 CET 2001