comparison 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
comparison
equal deleted inserted replaced
995:4575a219af58 996:25e260cb7994
122 (dependents (delete file (copy-sequence (file-dependents file))))) 122 (dependents (delete file (copy-sequence (file-dependents file)))))
123 (when dependents 123 (when dependents
124 (error "Loaded libraries %s depend on %s" 124 (error "Loaded libraries %s depend on %s"
125 (prin1-to-string dependents) file)))) 125 (prin1-to-string dependents) file))))
126 (let* ((flist (feature-symbols feature)) 126 (let* ((flist (feature-symbols feature))
127 (file (car flist))) 127 (file (car flist))
128 (unloading-module nil))
128 (flet ((reset-aload (x) 129 (flet ((reset-aload (x)
129 (let ((aload (get x 'autoload))) 130 (let ((aload (get x 'autoload)))
130 (if aload (fset x (cons 'autoload aload)))))) 131 (if aload (fset x (cons 'autoload aload))))))
131 (mapcar 132 (mapcar
132 #'(lambda (x) 133 #'(lambda (x)
133 (cond ((stringp x) nil) 134 (cond ((stringp x) nil)
134 ((consp x) 135 ((consp x)
135 ;; Remove any feature names that this file provided. 136 ;; Remove any feature names that this file provided.
136 (if (eq (car x) 'provide) 137 (if (eq (car x) 'provide)
137 (setq features (delq (cdr x) features)))) 138 (setq features (delq (cdr x) features))
139 (if (eq (car x) 'module)
140 (setq unloading-module t))))
138 ((and (boundp x) 141 ((and (boundp x)
139 (fboundp x)) 142 (fboundp x))
140 (makunbound x) 143 (makunbound x)
141 (fmakunbound x) 144 (fmakunbound x)
142 (reset-aload x)) 145 (reset-aload x))
146 (fmakunbound x) 149 (fmakunbound x)
147 (reset-aload x)))) 150 (reset-aload x))))
148 (cdr flist))) 151 (cdr flist)))
149 ;; Delete the load-history element for this file. 152 ;; Delete the load-history element for this file.
150 (let ((elt (assoc file load-history))) 153 (let ((elt (assoc file load-history)))
151 (setq load-history (delq elt load-history))))) 154 (setq load-history (delq elt load-history)))
155 ;; If it is a module, really unload it.
156 (if unloading-module
157 (unload-module (symbol-name feature)))))
152 158
153 (provide 'loadhist) 159 (provide 'loadhist)
154 160
155 ;;; loadhist.el ends here 161 ;;; loadhist.el ends here