[Pkg-jed-commit] r60 - in trunk/packages/jed/debian: . init.d patches

G. Milde g.milde at web.de
Mon Sep 19 11:17:48 UTC 2005


On 18.09.05, Jörg Sommer wrote:

> Added:
>    trunk/packages/jed/debian/patches/50_abbrev_fix.dpatch

We should report the bug (and patch) to John, IMHO.

>    trunk/packages/jed/debian/patches/50_popups.sl.dpatch

Also this one might be of interest upstream...


> * 05jed-common.sl
>   + really append the directory with register_libdir()

register_libdir() is now defined (in a config file !) but never used. :-(

register_libdir() has the name of a function in jedmodes.sf.net/mode/home-lib/
                  but a different functionality :-(

My suggestion:

define add_libdir() and define append_libdir() (naming as in a lot of
Jed's add|append pairs) in either register_libdir.sl (see attachment, was
home-lib.sl) or as a Debian patch to site.sl. (Do not forget the
documentation.)

This makes the config file easier to read and understand.
                                           
>   + do not change the Jed_Highlight_Cache_Dir with register_lib()

This seems sensible. Jed_Highlight_Cache_Dir should be set to the users
libdir in the users .jedrc instead (as otherwise user installed modes can
not cache the dfa syntax table).


>   + added support for /usr/local/jed (is this the right dir?)

I propose /usr/local/jed/ to mirror JED_ROOT, i.e. the library dir would
become /usr/local/jed/lib/.

However, I would make the registration of /usr/local/jed/lib/ an
outcommented option. Otherwise we will get: "jed reads the library of my
locally installed jed" bug reports.


The same holds for Jed_Home_Directory. The jed doc says this is 'where
personal jed-related files are assumed to be found', which (at least in
my case) is more than just *.sl files (.jedrecent, documentation, .jedrc,
templates, ...).

So for me, it is ~/.jed/lib/ and my .jedrc says:

  require("/home/milde/jed/lib/register-lib.sl"); 
  Jed_Home_Directory = expand_filename("~/.jed");
  add_libdir(path_concat(Jed_Home_Directory, "lib"));

If we cannot agree on a location for the user library, better leave
this configuration step to the users .jedrc. 


Guenter

-- 
G.Milde web.de
-------------- next part --------------
% Support for library directories with jed extensions
% 
% % Copyright (c) Günter Milde and released under the terms 
% of the GNU General Public License (version 2 or later).
% 
% Versions
% 0.9  2005-09-19  first public version, based on home-lib.sl
%
% FEATURES
% 
% the functions add_libdir(path) and append_libdir(path):
% 
%  * prepend|append `path' to the jed-library-path (searched for modes)
%  * set Color_Scheme_, dfa-cache- and documentation- path
%  * evaluate (if existent) the file ini.sl in path
%    (ini.sl files can be autocreated by make_ini.sl)
%  
% Together with make_ini.sl, this provides a convenient way of extending
% jed with contributed or home-made scripts.
% 
% INITIALIZATION
% 
% Write in your .jedrc (or jed.rc on winDOS) e.g.
%   require("register_lib", "/FULL_PATH_TO/register_lib.sl");
%   add_libdir(path_concat(Jed_Local_Directory, "lib"));
%   add_libdir(path_concat(Jed_Home_Directory, "lib"));
        
% Jed_Home_Directory
% ------------------
%
% Jed_Home_Directory is defined in site.sl, defaulting to $HOME
% previous versions contained code to change this to ~/.jed/
% 
% With the code below in jed.conf (or defaults.sl), Jed looks for .jedrc 
% in "~/.jed/".
% 
%   % If Jed_Home_Directory/.jed/ exists, point Jed_Home_Directory there,
%   $1 = path_concat(Jed_Home_Directory, ".jed");
%   if(2 == file_status($1))
%     Jed_Home_Directory = $1; 
%
% Alternatively, place .jedrc in HOME and set there
%   Jed_Home_Directory = path_concat(Jed_Home_Directory, ".jed");
  

%!%+
%\variable{Jed_Local_Directory}
%\synopsis{Directory for local site-wide jed extensions}
%\description
%\description
%  The value of this variable specifies the systems local "jed directory"
%  where system-wide non-standard jed-related files are assumed to be found.
%  Normally, this corresponds to "/usr/local/share/jed" on UNIX and
%  "$ALLUSERSPROFILE\\$APPDATA\\Jedsoft\\JED" on Windows
%  unless an alternate directory is specified via the \var{JED_LOCAL} 
%  environment variable. 
%
%  As it is a custom_variable, it can be set/changed in defaults.sl, jed.conf,
%  and/or .jedrc, of course.  
%  
%  It is set to "" if the specified directory does not exist.
%\seealso{JED_ROOT, Jed_Home_Directory}
%!%-
custom_variable("Jed_Local_Directory", getenv("JED_LOCAL"));
if (Jed_Local_Directory == NULL) % no custom or environment var set
{
#ifdef IBMPC_SYSTEM
   $2 = getenv("ALLUSERSPROFILE");
   $3 = getenv("APPDATA");
   if ($2 == NULL or $3 == NULL)
     Jed_Local_Directory = "";
   else
     Jed_Local_Directory = path_concat(path_concat($2, path_basename($3)), 
                                     "Jedsoft\\JED");
#else
     Jed_Local_Directory = "/usr/local/share/jed";
#endif
}

if (file_status(Jed_Local_Directory) != 2) % no directory
  Jed_Local_Directory = "";


%!%+
%\function{add_libdir}
%\synopsis{Register a library dir for use by jed}
%\usage{add_libdir(path)}
%\description
%  * Prepend \var{path} to the library path
%  * Set \var{Color_Scheme_Path}, \var{Jed_Doc_Files},
%    \var{Jed_Highlight_Cache_Dir}, and \var{Jed_Highlight_Cache_Path}
%  * Evaluate (if existent) the file \var{ini.sl} in this library
%    to enable initialization (autoloads etc)
%\example
%#v+
%  add_libdir(path_concat(Jed_Local_Directory, "lib"));
%  add_libdir(path_concat(Jed_Home_Directory, "lib"));
%#v-
% will register the local and user-specific library-dir
%\seealso{append_libdir, make_ini, set_jed_library_path, Jed_Doc_Files}
%\seealso{Color_Scheme_Path, Jed_Highlight_Cache_Dir, Jed_Highlight_Cache_Path}
%!%-
define add_libdir(lib)
{
   % abort, if directory doesnot exist
   if (orelse{lib == ""}{2 != file_status(lib)}) 
     continue;
   
   variable path;
   % jed library path
   set_jed_library_path(lib + "," + get_jed_library_path());
   % colors
   path = path_concat(lib, "colors");
   if (2 == file_status(path))
     Color_Scheme_Path = path + "," + Color_Scheme_Path;
   % documentation
   path = path_concat(lib, "libfuns.txt");
   if (1 == file_status(path))
     Jed_Doc_Files = path + "," + Jed_Doc_Files;
   % dfa cache
#ifdef HAS_DFA_SYNTAX
   % Jed_Highlight_Cache_Dir = lib;
   Jed_Highlight_Cache_Path = lib + "," + Jed_Highlight_Cache_Path;
#endif
   % Check for a file ini.sl containing initialization code
   % (e.g. autoload declarations) and evaluate it.
   path = path_concat(lib, "ini.sl");
   if (1 == file_status(path))
     () = evalfile(path);
}

%!%+
%\function{append_libdir}
%\synopsis{Register a library dir for use by jed}
%\usage{append_libdir(path)}
%\description
%  * Append \var{path} to the library path
%  * Set \var{Color_Scheme_Path}, \var{Jed_Doc_Files},
%    \var{Jed_Highlight_Cache_Dir}, and \var{Jed_Highlight_Cache_Path}
%  * Evaluate (if existent) the file \var{ini.sl} in this library
%    to enable initialization (autoloads etc)
%\example
%#v+
%  append_libdir(path_concat(Jed_Local_Directory, "lib"));
%#v-
% will register the local
%\seealso{add_libdir, make_ini, set_jed_library_path, Jed_Doc_Files}
%\seealso{Color_Scheme_Path, Jed_Highlight_Cache_Dir, Jed_Highlight_Cache_Path}
%!%-
define append_libdir(lib)
{
   % abort, if directory doesnot exist
   if (orelse{lib == ""}{2 != file_status(lib)}) 
     continue;
   
   variable path;
   % jed library path
   set_jed_library_path(get_jed_library_path() + "," + lib);
   % colors
   path = path_concat(lib, "colors");
   if (2 == file_status(path))
     Color_Scheme_Path = Color_Scheme_Path + "," + path;
   % documentation
   path = path_concat(lib, "libfuns.txt");
   if (1 == file_status(path))
     Jed_Doc_Files = Jed_Doc_Files + "," + path;
   % dfa cache
#ifdef HAS_DFA_SYNTAX
   Jed_Highlight_Cache_Path = Jed_Highlight_Cache_Path + "," + lib;
#endif
   % Check for a file ini.sl containing initialization code
   % (e.g. autoload declarations) and evaluate it.
   path = path_concat(lib, "ini.sl");
   if (1 == file_status(path))
     () = evalfile(path);
}



More information about the Pkg-jed-commit mailing list