diff lisp/loadhist.el @ 996:25e260cb7994

[xemacs-hg @ 2002-09-10 15:27:02 by james] Enable unloading of dynamic modules. Create the first two internal XEmacs modules: LDAP and postgreSQL. Update the sample directory to contain a sample internal XEmacs module and a sample external XEmacs module. Improve support for autoloading modules. Make internal module code compile into the XEmacs binary if XEmacs is configured without module support. Make the internal module directories self-contained so that they can be distributed separately from XEmacs.
author james
date Tue, 10 Sep 2002 15:27:39 +0000
parents abe6d1db359e
children 184461bc8de4
line wrap: on
line diff
--- a/lisp/loadhist.el	Mon Sep 09 21:53:43 2002 +0000
+++ b/lisp/loadhist.el	Tue Sep 10 15:27:39 2002 +0000
@@ -124,7 +124,8 @@
 	(error "Loaded libraries %s depend on %s"
 	       (prin1-to-string dependents) file))))
   (let* ((flist (feature-symbols feature))
-	 (file (car flist)))
+	 (file (car flist))
+	 (unloading-module nil))
     (flet ((reset-aload (x)
 	     (let ((aload (get x 'autoload)))
 	       (if aload (fset x (cons 'autoload aload))))))
@@ -134,7 +135,9 @@
 	       ((consp x)
 		;; Remove any feature names that this file provided.
 		(if (eq (car x) 'provide)
-		    (setq features (delq (cdr x) features))))
+		    (setq features (delq (cdr x) features))
+		  (if (eq (car x) 'module)
+		      (setq unloading-module t))))
 	       ((and (boundp x)
 		     (fboundp x))
 		(makunbound x)
@@ -148,7 +151,10 @@
      (cdr flist)))
     ;; Delete the load-history element for this file.
     (let ((elt (assoc file load-history)))
-      (setq load-history (delq elt load-history)))))
+      (setq load-history (delq elt load-history)))
+    ;; If it is a module, really unload it.
+    (if unloading-module
+	(unload-module (symbol-name feature)))))
 
 (provide 'loadhist)