Mercurial > hg > xemacs-beta
annotate lisp/loadhist.el @ 5652:cc6f0266bc36
Avoid #'delq in core Lisp, for the sake of style, a very slightly smaller binary
lisp/ChangeLog addition:
2012-05-01 Aidan Kehoe <kehoea@parhasard.net>
Avoid #'delq in core code, for the sake of style and a (very
slightly) smaller binary.
* behavior.el (disable-behavior):
* behavior.el (compute-behavior-group-children):
* buff-menu.el (buffers-tab-items):
* byte-optimize.el (byte-optimize-delay-constants-math):
* byte-optimize.el (byte-optimize-logmumble):
* byte-optimize.el (byte-decompile-bytecode-1):
* byte-optimize.el (byte-optimize-lapcode):
* bytecomp.el:
* bytecomp.el (byte-compile-arglist-warn):
* bytecomp.el (byte-compile-warn-about-unresolved-functions):
* bytecomp.el (byte-compile-lambda):
* bytecomp.el (byte-compile-out-toplevel):
* bytecomp.el (byte-compile-insert):
* bytecomp.el (byte-compile-defalias-warn):
* cl-macs.el (cl-upcase-arg):
* cl-macs.el (cl-transform-lambda):
* cl-macs.el (cl-do-proclaim):
* cl-macs.el (defstruct):
* cl-macs.el (cl-make-type-test):
* cl-macs.el (define-compiler-macro):
* cl-macs.el (delete-duplicates):
* cus-edit.el (widget-face-value-delete):
* cus-edit.el (face-history):
* easymenu.el (easy-menu-remove):
* files.el (files-fetch-hook-value):
* files.el (file-expand-wildcards):
* font-lock.el (font-lock-update-removed-keyword-alist):
* font-lock.el (font-lock-remove-keywords):
* frame.el (frame-initialize):
* frame.el (frame-notice-user-settings):
* frame.el (set-frame-font):
* frame.el (delete-other-frames):
* frame.el (get-frame-for-buffer-noselect):
* gnuserv.el (gnuserv-kill-buffer-function):
* gnuserv.el (gnuserv-check-device):
* gnuserv.el (gnuserv-kill-client):
* gnuserv.el (gnuserv-buffer-done-1):
* gtk-font-menu.el (gtk-reset-device-font-menus):
* gutter-items.el (buffers-tab-items):
* gutter.el (set-gutter-element-visible-p):
* info.el (Info-find-file-node):
* info.el (Info-history-add):
* info.el (Info-build-annotation-completions):
* info.el (Info-index):
* info.el (Info-reannotate-node):
* itimer.el (delete-itimer):
* itimer.el (start-itimer):
* lib-complete.el (lib-complete:cache-completions):
* loadhist.el (unload-feature):
* menubar-items.el (build-buffers-menu-internal):
* menubar.el (delete-menu-item):
* menubar.el (relabel-menu-item):
* msw-font-menu.el (mswindows-reset-device-font-menus):
* mule/make-coding-system.el (fixed-width-generate-helper):
* next-error.el (next-error-find-buffer):
* obsolete.el:
* obsolete.el (find-non-ascii-charset-string):
* obsolete.el (find-non-ascii-charset-region):
* occur.el (multi-occur-by-filename-regexp):
* occur.el (occur-1):
* packages.el (packages-package-hierarchy-directory-names):
* packages.el (package-get-key-1):
* process.el (setenv):
* simple.el (undo):
* simple.el (handle-pre-motion-command-current-command-is-motion):
* sound.el (load-sound-file):
* wid-edit.el (widget-field-value-delete):
* wid-edit.el (widget-checklist-match-inline):
* wid-edit.el (widget-checklist-match-find):
* wid-edit.el (widget-editable-list-delete-at):
* wid-edit.el (widget-editable-list-entry-create):
* window.el (quit-window):
* x-font-menu.el (x-reset-device-font-menus-core):
1. Replace (delq nil (mapcar ....)) with analogous (mapcan ...)
forms; this is in non-dumped files, it was done previously in
dumped files.
2. Replace (delq FOO (copy-sequence BAR)) with (remove* FOO BAR),
where #'eq and #'eql are equivalent
3. Replace (delq FOO BAR) with (delete* FOO BAR), where FOO is not
a non-fixnum number. Saves a little space in the dumped file
(since the compiler macro adds :test #'eq to the delete* call if
it's not clear that FOO is not a non-fixnum number).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 01 May 2012 16:17:42 +0100 |
parents | 071b810ceb18 |
children |
rev | line source |
---|---|
428 | 1 ;;; loadhist.el --- lisp functions for working with feature groups |
2 | |
3 ;; Copyright (C) 1995 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | |
6 ;; Version: 1.0 | |
7 ;; Keywords: internal, dumped | |
8 | |
9 ;; This file is part of XEmacs. | |
10 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
11 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
12 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
13 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
14 ;; option) any later version. |
428 | 15 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
16 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
18 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
19 ;; for more details. |
428 | 20 |
21 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5206
diff
changeset
|
22 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
428 | 23 |
24 ;;; Synched up with: FSF 20.2. | |
25 | |
4367
69e6352406f0
Handle macros, autoloads correctly in symbol-file. Add an incomplete TYPE arg.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3511
diff
changeset
|
26 ;; #### Sync this file! |
69e6352406f0
Handle macros, autoloads correctly in symbol-file. Add an incomplete TYPE arg.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3511
diff
changeset
|
27 |
428 | 28 ;;; Commentary: |
29 | |
30 ;; This file is dumped with XEmacs. | |
31 | |
32 ;; These functions exploit the load-history system variable. | |
33 ;; Entry points include `unload-feature', `symbol-file', and `feature-file'. | |
34 | |
35 ;;; Code: | |
36 | |
37 ;; load-history is a list of entries that look like this: | |
38 ;; ("outline" outline-regexp ... (require . wid-edit) ... (provide . outline) ...) | |
39 | |
4539
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
40 ;; XEmacs; this function is in subr.el in GNU, and does not deal with |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
41 ;; built-in symbols. |
4540
7e01763ea656
Correct a misunderstanding of the semantics of #'return in #'symbol-file.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4539
diff
changeset
|
42 (defun* symbol-file (sym &optional type) |
428 | 43 "Return the input source from which SYM was loaded. |
4367
69e6352406f0
Handle macros, autoloads correctly in symbol-file. Add an incomplete TYPE arg.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3511
diff
changeset
|
44 This is a file name, or nil if the source was a buffer with no associated file. |
69e6352406f0
Handle macros, autoloads correctly in symbol-file. Add an incomplete TYPE arg.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3511
diff
changeset
|
45 |
69e6352406f0
Handle macros, autoloads correctly in symbol-file. Add an incomplete TYPE arg.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3511
diff
changeset
|
46 If TYPE is nil or omitted, any kind of definition is acceptable. |
4905
755ae5b97edb
Change "special form" to "special operator" in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4783
diff
changeset
|
47 If TYPE is `defun', then function, subr, special operator or macro definitions |
4367
69e6352406f0
Handle macros, autoloads correctly in symbol-file. Add an incomplete TYPE arg.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3511
diff
changeset
|
48 are acceptable. |
69e6352406f0
Handle macros, autoloads correctly in symbol-file. Add an incomplete TYPE arg.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3511
diff
changeset
|
49 If TYPE is `defvar', then variable definitions are acceptable. |
69e6352406f0
Handle macros, autoloads correctly in symbol-file. Add an incomplete TYPE arg.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3511
diff
changeset
|
50 |
4535
69a1eda3da06
Distinguish vars and functions in #'symbol-file, #'describe-{function,variable}
Aidan Kehoe <kehoea@parhasard.net>
parents:
4367
diff
changeset
|
51 `defface' specifies a face definition only, and for the moment, it won't |
69a1eda3da06
Distinguish vars and functions in #'symbol-file, #'describe-{function,variable}
Aidan Kehoe <kehoea@parhasard.net>
parents:
4367
diff
changeset
|
52 return faces created with `make-face' or `copy-face', just those created |
69a1eda3da06
Distinguish vars and functions in #'symbol-file, #'describe-{function,variable}
Aidan Kehoe <kehoea@parhasard.net>
parents:
4367
diff
changeset
|
53 with `defface' and `custom-declare-face'." |
428 | 54 (interactive "SFind source file for symbol: ") ; XEmacs |
4539
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
55 (let (built-in-file autoload-cons symbol-details) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
56 (cond ((and (eq 'autoload |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
57 (car-safe |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
58 (setq autoload-cons |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
59 (and (fboundp sym) (symbol-function sym))))) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
60 (or (and (or (null type) (eq 'defvar type)) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
61 (eq (fifth autoload-cons) 'keymap)) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
62 (and (or (null type) (eq 'defun type)) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
63 (memq (fifth autoload-cons) '(nil macro))))) |
4540
7e01763ea656
Correct a misunderstanding of the semantics of #'return in #'symbol-file.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4539
diff
changeset
|
64 (return-from symbol-file (locate-library (second autoload-cons)))) |
4539
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
65 ((eq 'defvar type) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
66 ;; Load history entries corresponding to variables are just |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
67 ;; symbols. |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
68 (dolist (entry load-history) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
69 (when (memq sym (cdr entry)) |
4540
7e01763ea656
Correct a misunderstanding of the semantics of #'return in #'symbol-file.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4539
diff
changeset
|
70 (return-from symbol-file (car entry))))) |
4539
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
71 ((not (null type)) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
72 ;; Non-variables have the type stored as the car of the entry. |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
73 (dolist (entry load-history) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
74 (when (and (setq symbol-details (rassq sym (cdr entry))) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
75 (eq type (car symbol-details))) |
4540
7e01763ea656
Correct a misunderstanding of the semantics of #'return in #'symbol-file.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4539
diff
changeset
|
76 (return-from symbol-file (car entry))))) |
4539
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
77 (t |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
78 ;; If TYPE hasn't been specified, we need to check both for |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
79 ;; variables and other symbols. |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
80 (dolist (entry load-history) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
81 (when (or (memq sym (cdr entry)) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
82 (rassq sym (cdr entry))) |
4540
7e01763ea656
Correct a misunderstanding of the semantics of #'return in #'symbol-file.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4539
diff
changeset
|
83 (return-from symbol-file (car entry)))))) |
4539
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
84 (when (setq built-in-file (built-in-symbol-file sym type)) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
85 (if (equal built-in-file (file-truename built-in-file)) |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
86 ;; Probably a full path name: |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
87 built-in-file |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
88 ;; This is a bit heuristic, but shouldn't realistically be a |
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
89 ;; problem: |
5206
39d74978fd32
Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4915
diff
changeset
|
90 (if (string-match #r"\.elc?$" built-in-file) |
4915
bedf3747a6d7
Use DOC for dumped Lisp file names; Xref to source-lisp if readable, symbol-file
Aidan Kehoe <kehoea@parhasard.net>
parents:
4905
diff
changeset
|
91 (concat (if (file-readable-p source-lisp) |
bedf3747a6d7
Use DOC for dumped Lisp file names; Xref to source-lisp if readable, symbol-file
Aidan Kehoe <kehoea@parhasard.net>
parents:
4905
diff
changeset
|
92 source-lisp |
bedf3747a6d7
Use DOC for dumped Lisp file names; Xref to source-lisp if readable, symbol-file
Aidan Kehoe <kehoea@parhasard.net>
parents:
4905
diff
changeset
|
93 lisp-directory) |
bedf3747a6d7
Use DOC for dumped Lisp file names; Xref to source-lisp if readable, symbol-file
Aidan Kehoe <kehoea@parhasard.net>
parents:
4905
diff
changeset
|
94 built-in-file) |
4539
061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4535
diff
changeset
|
95 (concat source-directory "/src/" built-in-file)))))) |
428 | 96 |
97 (defun feature-symbols (feature) | |
98 "Return the file and list of symbols associated with a given FEATURE." | |
99 (let ((pair `(provide . ,feature))) | |
100 (dolist (entry load-history) | |
101 (when (member pair (cdr entry)) | |
102 (return entry))))) | |
103 | |
104 (defun feature-file (feature) | |
105 "Return the file name from which a given FEATURE was loaded. | |
106 Actually, return the load argument, if any; this is sometimes the name of a | |
107 Lisp file without an extension. If the feature came from an eval-buffer on | |
108 a buffer with no associated file, or an eval-region, return nil." | |
109 (unless (featurep feature) | |
110 (error "%s is not a currently loaded feature" (symbol-name feature))) | |
111 (car (feature-symbols feature))) | |
112 | |
113 (defun file-symbols (file) | |
114 "Return the file and list of symbols associated with FILE. | |
115 The file name in the returned list is the string used to load the file, | |
116 and may not be the same string as FILE, but it will be equivalent." | |
117 (or (assoc file load-history) | |
118 (assoc (file-name-sans-extension file) load-history) | |
119 (assoc (concat file ".el") load-history) | |
120 (assoc (concat file ".elc") load-history))) | |
121 | |
122 (defun file-provides (file) | |
123 "Return the list of features provided by FILE." | |
124 (let ((provides nil)) | |
125 (dolist (x (cdr (file-symbols file))) | |
126 (when (eq (car-safe x) 'provide) | |
127 (push (cdr x) provides))) | |
128 provides)) | |
129 | |
130 (defun file-requires (file) | |
131 "Return the list of features required by FILE." | |
132 (let ((requires nil)) | |
133 (dolist (x (cdr (file-symbols file))) | |
134 (when (eq (car-safe x) 'require) | |
135 (push (cdr x) requires))) | |
136 requires)) | |
137 | |
138 (defun file-dependents (file) | |
139 "Return the list of loaded libraries that depend on FILE. | |
140 This can include FILE itself." | |
141 (let ((provides (file-provides file)) | |
142 (dependents nil)) | |
143 (dolist (entry load-history) | |
144 (dolist (x (cdr entry)) | |
145 (when (and (eq (car-safe x) 'require) | |
146 (memq (cdr-safe x) provides)) | |
147 (push (car entry) dependents)))) | |
148 dependents)) | |
149 | |
150 ;; FSFmacs | |
151 ;(defun read-feature (prompt) | |
152 ; "Read a feature name \(string\) from the minibuffer, | |
153 ;prompting with PROMPT and completing from `features', and | |
154 ;return the feature \(symbol\)." | |
155 ; (intern (completing-read prompt | |
156 ; (mapcar #'(lambda (feature) | |
157 ; (list (symbol-name feature))) | |
158 ; features) | |
159 ; nil t))) | |
160 | |
161 ;; ;;;###autoload | |
162 (defun unload-feature (feature &optional force) | |
163 "Unload the library that provided FEATURE, restoring all its autoloads. | |
164 If the feature is required by any other loaded code, and optional FORCE | |
165 is nil, raise an error." | |
166 (interactive "SFeature: ") | |
167 (unless (featurep feature) | |
168 (error "%s is not a currently loaded feature" (symbol-name feature))) | |
169 (when (not force) | |
170 (let* ((file (feature-file feature)) | |
171 (dependents (delete file (copy-sequence (file-dependents file))))) | |
172 (when dependents | |
173 (error "Loaded libraries %s depend on %s" | |
174 (prin1-to-string dependents) file)))) | |
442 | 175 (let* ((flist (feature-symbols feature)) |
996 | 176 (file (car flist)) |
177 (unloading-module nil)) | |
5567
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
178 (labels ((reset-aload (x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
179 (let ((aload (get x 'autoload))) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
180 (if aload (fset x (cons 'autoload aload)))))) |
5576
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5567
diff
changeset
|
181 (declare (inline reset-aload)) |
5567
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
182 (mapc |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
183 #'(lambda (x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
184 (cond ((stringp x) nil) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
185 ((consp x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
186 ;; Remove any feature names that this file provided. |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
187 (if (eq (car x) 'provide) |
5652
cc6f0266bc36
Avoid #'delq in core Lisp, for the sake of style, a very slightly smaller binary
Aidan Kehoe <kehoea@parhasard.net>
parents:
5576
diff
changeset
|
188 (setq features (delete* (cdr x) features)) |
5567
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
189 (if (eq (car x) 'module) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
190 (setq unloading-module t)))) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
191 ((and (boundp x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
192 (fboundp x)) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
193 (makunbound x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
194 (fmakunbound x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
195 (reset-aload x)) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
196 ((boundp x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
197 (makunbound x)) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
198 ((fboundp x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
199 (fmakunbound x) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
200 (reset-aload x)))) |
3bc58dc9d688
Replace #'flet by #'labels where appropriate, core code.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
201 (cdr flist))) |
428 | 202 ;; Delete the load-history element for this file. |
203 (let ((elt (assoc file load-history))) | |
5652
cc6f0266bc36
Avoid #'delq in core Lisp, for the sake of style, a very slightly smaller binary
Aidan Kehoe <kehoea@parhasard.net>
parents:
5576
diff
changeset
|
204 (setq load-history (delete* elt load-history))) |
996 | 205 ;; If it is a module, really unload it. |
206 (if unloading-module | |
1111 | 207 (declare-fboundp (unload-module (symbol-name feature)))))) |
428 | 208 |
209 (provide 'loadhist) | |
210 | |
211 ;;; loadhist.el ends here |