From xemacs-m  Thu Mar  6 23:38:45 1997
Received: from beavis.bayserve.net (jmiller@port96.bayserve.net [206.148.244.187])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id XAA09750
	for <xemacs-beta@xemacs.org>; Thu, 6 Mar 1997 23:38:43 -0600 (CST)
Received: (from jmiller@localhost) by beavis.bayserve.net (8.7.5/8.7.3) id BAA19757; Fri, 7 Mar 1997 01:10:32 -0500
Date: Fri, 7 Mar 1997 01:10:32 -0500
Message-Id: <199703070610.BAA19757@beavis.bayserve.net>
From: Jeff Miller <jmiller@bayserve.net>
To: xemacs-beta@xemacs.org
Subject: site-directory patch
Reply-to: jmiller@bayserve.net
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: multipart/mixed;
 boundary="Multipart_Fri_Mar__7_01:10:29_1997-1"
Content-Transfer-Encoding: 7bit

--Multipart_Fri_Mar__7_01:10:29_1997-1
Content-Type: text/plain; charset=US-ASCII


I was fiddling around trying to make some of my startup stuff more generic
& not hard coded.  I was trying to get the site-lisp directory and found
that it did not seem to be represented by a variable ala data-directory
does for the etc directory.

It looked like there was already some code to determine the site-lisp dir
but it wasn't being assigned to a variable someone could use. So I hacked
this together.  It seems to work like I expect.  

*note: if you apply this patch, you'll probably get a rejection on
emacsfns.h. I can't for the life of me figure out why. It's only a 1 line
change, so you'll probably have to hand-do it.  

ok, let's see how this mime - attachment stuff works......



--Multipart_Fri_Mar__7_01:10:29_1997-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="site-dir.patch"
Content-Transfer-Encoding: quoted-printable

--- src/alloc.c.orig    Thu Mar  6 22:21:31 1997
+++ src/alloc.c Thu Mar  6 22:21:54 1997
@@ -3825,6 +3825,7 @@
   Vprocess_environment =3D Qnil;
   Vexec_directory =3D Qnil;
   Vdata_directory =3D Qnil;
+  Vsite_directory =3D Qnil;
   Vdoc_directory =3D Qnil;
   Vconfigure_info_directory =3D Qnil;
   Vexec_path =3D Qnil;
--- lisp/prim/startup.el.orig   Thu Mar  6 22:36:27 1997
+++ lisp/prim/startup.el        Thu Mar  6 23:23:34 1997
@@ -1193,6 +1193,13 @@
                    )
                  ))
 =

+    ;; 1997/03/06 by Jeff Miller <jmiller@bayserve.net>
+    ;; initialize 'site-directory'.  This is the site-lisp dir used by =

+    ;; XEmacs
+     (if site-lisp
+        (setq site-directory (file-name-as-directory site-lisp))
+         )
+
     ;; If running from the build directory, always prefer the exec-direc=
tory
     ;; that is here over the one that came from paths.h.
     (if (or (and (null exec-directory) lib-src)
--- src/callproc.c.orig	Thu Mar  6 23:34:19 1997
+++ src/callproc.c	Thu Mar  6 23:54:08 1997
@@ -49,7 +49,7 @@
 #endif /* DOS_NT */
 =

 Lisp_Object Vexec_path, Vexec_directory, Vdata_directory, Vdoc_directory=
;
-Lisp_Object Vconfigure_info_directory;
+Lisp_Object Vconfigure_info_directory, Vsite_directory;
 =

 /* The default base directory XEmacs is installed under. */
 Lisp_Object Vprefix_directory;
@@ -946,6 +946,7 @@
   if (!initialized)
     {
       Vdata_directory =3D Qnil;
+      Vsite_directory =3D Qnil;
       Vdoc_directory  =3D Qnil;
       Vexec_path      =3D Qnil;
     }
@@ -953,6 +954,7 @@
 #endif
     {
       char *data_dir =3D egetenv ("EMACSDATA");
+      char *site_dir =3D egetenv ("EMACSSITE");
       char *doc_dir  =3D egetenv ("EMACSDOC");
     =

 #ifdef PATH_DATA
@@ -963,6 +965,10 @@
       if (!doc_dir)
 	doc_dir =3D (char *) PATH_DOC;
 #endif
+#ifdef PATH_SITE
+      if (!site_dir)
+	site_dir =3D (char *) PATH_SITE;
+#endif
     =

       if (data_dir)
 	Vdata_directory =3D Ffile_name_as_directory
@@ -974,6 +980,11 @@
 	  (build_string (doc_dir));
       else
 	Vdoc_directory =3D Qnil;
+      if (site_dir)
+	Vsite_directory =3D Ffile_name_as_directory
+	  (build_string (site_dir));
+      else
+	Vsite_directory =3D Qnil;
 =

       /* Check the EMACSPATH environment variable, defaulting to the
 	 PATH_EXEC path from paths.h.  */
@@ -1032,6 +1043,24 @@
 	}
     }
   =

+  if (!NILP (Vsite_directory))
+    {
+      tempdir =3D Fdirectory_file_name (Vsite_directory);
+      if (access ((char *) XSTRING_DATA (tempdir), 0) < 0)
+	{
+	  /* If the hard-coded path is bogus, fail silently.
+	     This will allow the normal heuristics to make an attempt. */
+#if 0
+	  warn_when_safe
+	    (Qpath, Qwarning,
+	     "Warning: machine-independent site dir (%s) does not exist.\n",
+	     XSTRING_DATA (Vsite_directory));
+#else
+	  Vsite_directory =3D Qnil;
+#endif
+	}
+    }
+  =

 #ifdef PATH_PREFIX
   Vprefix_directory =3D build_string ((char *) PATH_PREFIX);
 #else
@@ -1117,6 +1146,11 @@
 =

   DEFVAR_LISP ("data-directory", &Vdata_directory /*
 Directory of architecture-independent files that come with XEmacs,
+intended for Emacs to use.
+*/ );
+
+  DEFVAR_LISP ("site-directory", &Vsite_directory /*
+Directory of architecture-independent files that do not come with XEmacs=
,
 intended for Emacs to use.
 */ ); =



--- src/emacsfns.h.orig Fri Mar  7 00:05:34 1997
+++ src/emacsfns.h      Fri Mar  7 00:10:56 1997
@@ -217,7 +217,7 @@
 =

 /* Defined in callproc.c */
 extern Lisp_Object Vexec_path, Vexec_directory, Vdata_directory,
-                  Vdoc_directory;
+                  Vdoc_directory, Vsite_directory;
 =

 =

 /* Defined in casefiddle.c */

--Multipart_Fri_Mar__7_01:10:29_1997-1
Content-Type: text/plain; charset=US-ASCII




--Multipart_Fri_Mar__7_01:10:29_1997-1--

