From xemacs-m  Wed Feb 26 20:24:36 1997
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id UAA19305
	for <xemacs-beta@xemacs.org>; Wed, 26 Feb 1997 20:24:36 -0600 (CST)
Received: (from steve@localhost)
	by altair.xemacs.org (8.8.5/8.8.5) id SAA05457;
	Wed, 26 Feb 1997 18:36:20 -0800
Mail-Copies-To: never
To: xemacs-beta@xemacs.org
Subject: site-load patch for 19.15
X-Url: http://www.miranova.com/%7Esteve/
X-Face: #!T9!#9s-3o8)*uHlX{Ug[xW7E7Wr!*L46-OxqMu\xz23v|R9q}lH?cRS{rCNe^'[`^sr5"
 f8*@r4ipO6Jl!:Ccq<xoV[Qz2u8<8-+Vwf2gzJ44lf_/y9OaQ`@#Q65{U4/TC)i2`~/M&QI$X>p:9I
 OSS'2{-)-4wBnVeg0S\O4Al@)uC[pD|+
X-Attribution: sb
From: Steven L Baur <steve@miranova.com>
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: multipart/mixed;
 boundary="Multipart_Wed_Feb_26_18:36:19_1997-1"
Content-Transfer-Encoding: 7bit
Date: 26 Feb 1997 18:36:19 -0800
Message-ID: <m2d8tn0ycc.fsf@altair.xemacs.org>
Lines: 193
X-Mailer: Gnus v5.4.15/XEmacs 20.1

--Multipart_Wed_Feb_26_18:36:19_1997-1
Content-Type: text/plain; charset=US-ASCII

Here's the integrated site-load/DOC file generation patch for 19.15.


--Multipart_Wed_Feb_26_18:36:19_1997-1
Content-Type: application/octet-stream; type=emacs-lisp
Content-Disposition: attachment; filename="site-load.el"
Content-Transfer-Encoding: 7bit

;;; site-load.el --- Template file for site-wide XEmacs customization

;; Author: Steven L. Baur <steve@altair.xemacs.org>
;; Keywords: internal

;; This file is part of XEmacs.

;;; Commentary:

;; This is a prototype site-load.el file.
;; The site-load.el mechanism is provided so XEmacs installers can easily
;; dump lisp packages with XEmacs that do not get dumped standardly.

;; The file `site-packages' if it exists should look something like:
;; (setq site-load-packages '(
;; "../lisp/modes/cc-mode"
;; "../lisp/utils/redo"
;; "../lisp/packages/scroll-in-place"
;; )
;; )

;; The first line and the last line must be exact.  Each of the packages
;; listed must be double quoted, have either an absolute path, or a relative
;; to the build src directory path *and* be bytecompiled prior to the attempt
;; to dump.

;; Because this is a trial implementation and the file is shared with
;; make-docfiles, syntax is strict and unforgiving.  So sue me.  It
;; is still better than the way it used to be.

;;; Code:
(defvar site-load-package-file "../lisp/site-packages"
  "File name containing the list of extra packages to dump with XEmacs.")
(defvar site-load-packages nil
  "A list of .elc files that should be dumped with XEmacs.
This variable should be set by `site-load-package-file'.")

;; Load site specific packages for dumping with the XEmacs binary.
(when (file-exists-p site-load-package-file) 
  (let ((file))
    (load site-load-package-file t t t)
    ;; The `load-gc' macro is provided as a clue that a package is being loaded
    ;; in preparation of being dumped into XEmacs.
    (defmacro load-gc (file)
      (list 'prog1 (list 'load file) '(garbage-collect)))
    (message "Loading site-wide packages for dumping...")
    (while site-load-packages
      (setq file (car site-load-packages))
      (load-gc file)
      (setq site-load-packages (cdr site-load-packages)))
    (message "Loading site-wide packages for dumping...done")
    (fmakunbound 'load-gc)))

;; This file is intended for end user additions.
;; Put other initialization here, like setting of language-environment, etc.
;; Perhaps this should really be in the site-init.el.

;;; site-load.el ends here

--Multipart_Wed_Feb_26_18:36:19_1997-1
Content-Type: text/plain; charset=US-ASCII

Index: src/Makefile.in.in
===================================================================
RCS file: /usr/local/xemacs/xemacs-19.15/src/Makefile.in.in,v
retrieving revision 1.9
diff -u -r1.9 Makefile.in.in
--- Makefile.in.in	1997/02/22 22:08:31	1.9
+++ Makefile.in.in	1997/02/27 02:17:25
@@ -1242,7 +1243,8 @@
 ${libsrc}DOC: ${libsrc}make-docfile ${obj_src} ${lisp}
 #endif
 	rm -f ${libsrc}DOC
-	${libsrc}make-docfile -d ${srcdir} ${obj_src} \
+	${libsrc}make-docfile -d ${srcdir} -i ${lispdir}site-packages \
+		${obj_src} \
 	        ${mallocdocsrc} ${rallocdocsrc} ${lispdir}version.el \
 		${lisp} > ${libsrc}DOC
 

Index: lib-src/make-docfile.c
===================================================================
RCS file: /usr/local/xemacs/xemacs-19.15/lib-src/make-docfile.c,v
retrieving revision 1.2
diff -u -r1.2 make-docfile.c
--- make-docfile.c	1997/02/09 23:51:24	1.2
+++ make-docfile.c	1997/02/27 02:20:34
@@ -33,6 +33,9 @@
  Then comes F for a function or V for a variable.
  Then comes the function or variable name, terminated with a newline.
  Then comes the documentation for that function or variable.
+
+ Added 19.15/20.1:  `-i site-packages' allow installer to dump extra packages
+ without modifying Makefiles, etc.
  */
 
 #define NO_SHORTNAMES   /* Tell config not to load remap.h */
@@ -74,6 +77,7 @@
 
 /* Stdio stream for output to the DOC file.  */
 static FILE *outfile;
+static char *extra_elcs = NULL;
 
 enum
 {
@@ -130,6 +134,42 @@
   return result;
 }
 
+
+static char *
+next_extra_elc(char *extra_elcs)
+{
+  static FILE *fp = NULL;
+  static char line_buf[BUFSIZ];
+  char *p = line_buf+1;
+
+  if (!fp) {
+    if (!extra_elcs) {
+      return NULL;
+    } else if (!(fp = fopen(extra_elcs, "r"))) {
+      /* It is not an error if this file doesn't exist. */
+      /*fatal("error opening site package file list", 0);*/
+      return NULL;
+    }
+    fgets(line_buf, BUFSIZ, fp);
+  }
+
+again:
+  if (!fgets(line_buf, BUFSIZ, fp)) {
+    fclose(fp);
+    fp = NULL;
+    return NULL;
+  }
+  line_buf[0] = '\0';
+  if (strlen(p) <= 2 || strlen(p) >= (BUFSIZ - 5)) {
+    /* reject too short or too long lines */
+    goto again;
+  }
+  p[strlen(p) - 2] = '\0';
+  strcat(p, ".elc");
+
+  return p;
+}
+
 
 int
 main (int argc, char **argv)
@@ -175,6 +215,11 @@
       i += 2;
     }
 
+  if (argc > (i + 1) && !strcmp(argv[i], "-i")) {
+    extra_elcs = argv[i + 1];
+    i += 2;
+  }
+
   if (outfile == 0)
     fatal ("No output file specified", "");
 
@@ -190,6 +235,15 @@
 	/* err_count seems to be {mis,un}used */
 	err_count += scan_file (argv[i]);
     }
+
+  if (extra_elcs) {
+    char *p;
+
+    while ((p = next_extra_elc(extra_elcs)) != NULL) {
+      err_count += scan_file(p);
+    }
+  }
+
   putc ('\n', outfile);
 #ifndef VMS
   exit (err_count > 0);

-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be billed at $250/message.

--Multipart_Wed_Feb_26_18:36:19_1997-1--

