slsh/local-packages

G. Milde milde at users.sourceforge.net
Mon Apr 14 12:44:18 UTC 2008


On 14.04.08, Jörg Sommer wrote:
> G. Milde schrieb am Mon 14. Apr, 11:11 (+0200):
> > +++ /home/milde/.jed/lib/test/site.sl	2008-04-14 10:36:19.000000000 +0200
...
> > -	     guess_jed_install_prefix ()
> > +	     guess_jed_install_prefix (),

> Is this intended?

The comma is a leftover from the (tentative) adding of
"/usr/local/share/slsh" to the array of prefixes. It does not do any
harm, however, as it is ignored by the interpreter.

> > -	$1 = path_concat ($1, "share/slsh/local-packages");
> > +	$1 = path_concat ($1, "share/slsh");
> > +	if (2 != file_status ($1))
> > +	  continue;
> > +	set_jed_library_path (strcat (get_jed_library_path (), ",", $1));
> > +	$1 = path_concat ($1, "local-packages");
> >  	if (2 != file_status ($1))
> >  	  continue;

> Should it really continue in this case? There's a break at the end of
> this block. I would put the set_jed_library_path() into the then branch.

The break is here for the case that both _slang_install_prefix, and
guess_jed_install_prefix () return the same prefix.

This way of handling a duplicate will no longer work nicely if a local
and|or user slsh library path shall be added as well.

Still the minimal patch should be

--- /usr/share/jed/lib/site.sl	2007-09-09 19:41:00.000000000 +0200
+++ /home/milde/.jed/lib/test/site.sl	2008-04-14 14:20:48.000000000 +0200
@@ -3252,11 +3252,13 @@
 	     ])
      {
 	$1 = ();
-	$1 = path_concat ($1, "share/slsh/local-packages");
+	$1 = path_concat ($1, "share/slsh");
 	if (2 != file_status ($1))
 	  continue;
-	set_jed_library_path (strcat (get_jed_library_path (), ",", path_dirname ($1)));
 	set_jed_library_path (strcat (get_jed_library_path (), ",", $1));
+	$1 = path_concat ($1, "local-packages");
+	if (2 == file_status ($1))
+	   set_jed_library_path (strcat (get_jed_library_path (), ",", $1));
 	break;
      }
 }

Adding the help files (currently done in jed.d/05jed-common.sl) could be
added like

--- /usr/share/jed/lib/site.sl	2007-09-09 19:41:00.000000000 +0200
+++ /home/milde/.jed/lib/test/site.sl	2008-04-14 14:43:25.000000000 +0200
@@ -3244,20 +3244,37 @@
 #ifdef UNIX
 if (is_defined ("import"))
 {
-   foreach ([
+   foreach $1 ([
 # ifexists _slang_install_prefix
-	     _slang_install_prefix,
+		_slang_install_prefix,
 # endif
-	     guess_jed_install_prefix ()
-	     ])
+		guess_jed_install_prefix (),
+		"/usr/local"
+	       ])
+     % TODO: remove doublettes
      {
-	$1 = ();
-	$1 = path_concat ($1, "share/slsh/local-packages");
-	if (2 != file_status ($1))
-	  continue;
-	set_jed_library_path (strcat (get_jed_library_path (), ",", path_dirname ($1)));
-	set_jed_library_path (strcat (get_jed_library_path (), ",", $1));
-	break;
+	$1 = path_concat ($1, "share/slsh");
+	foreach $2 (["", "local-packages"]) 
+	  {
+	     $2 = path_concat($1, $2);
+	     if (2 != file_status ($2))
+		break;
+	     set_jed_library_path (strcat (get_jed_library_path (), ",", $2));
+
+	     % add on-line help documents
+	     $2 = path_concat($2, "help");
+	     if (file_status($2) != 2)
+		continue;
+
+	     foreach $2 (listdir($2))
+		if (path_extname($2) == ".hlp")
+		  {
+		     % the doc path set with add_doc_file() is currently not
+		     % recognized by the standard help.sl
+		     % add_doc_file($4);
+		     Jed_Doc_Files += "," + $2;
+		  }
+	  }
      }
 }
 #endif


GM




More information about the Pkg-jed-devel mailing list