Mercurial > emacs
annotate lisp/loadhist.el @ 100111:70331b8d068a
(c-tab-always-indent, c-insert-tab-function): Doc fix. (Bug#1368)
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 02 Dec 2008 03:32:05 +0000 |
parents | 02171540ee2a |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
2543 | 1 ;;; loadhist.el --- lisp functions for working with feature groups |
14169 | 2 |
74442 | 3 ;; Copyright (C) 1995, 1998, 2000, 2001, 2002, 2003, 2004, |
79721 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
2543 | 5 |
6 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | |
29090
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
7 ;; Maintainer: FSF |
2543 | 8 ;; Keywords: internal |
9 | |
11289 | 10 ;; This file is part of GNU Emacs. |
11 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87973
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
11289 | 13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87973
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87973
diff
changeset
|
15 ;; (at your option) any later version. |
11289 | 16 |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87973
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
11289 | 24 |
2543 | 25 ;;; Commentary: |
26 | |
27 ;; These functions exploit the load-history system variable. | |
22459
bc88a299d2fc
(read-feature): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
16173
diff
changeset
|
28 ;; Entry points include `unload-feature', `symbol-file', and |
bc88a299d2fc
(read-feature): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
16173
diff
changeset
|
29 ;; `feature-file', documented in the Emacs Lisp manual. |
2543 | 30 |
31 ;;; Code: | |
32 | |
69935
3fc0524ae318
(unload-feature): A bit of sanity check of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69165
diff
changeset
|
33 (eval-when-compile (require 'cl)) |
3fc0524ae318
(unload-feature): A bit of sanity check of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69165
diff
changeset
|
34 |
2543 | 35 (defun feature-symbols (feature) |
47017
0ba62d75345e
(unload-feature): Distinguish functions from variables in load-history.
Richard M. Stallman <rms@gnu.org>
parents:
33094
diff
changeset
|
36 "Return the file and list of definitions associated with FEATURE. |
0ba62d75345e
(unload-feature): Distinguish functions from variables in load-history.
Richard M. Stallman <rms@gnu.org>
parents:
33094
diff
changeset
|
37 The value is actually the element of `load-history' |
0ba62d75345e
(unload-feature): Distinguish functions from variables in load-history.
Richard M. Stallman <rms@gnu.org>
parents:
33094
diff
changeset
|
38 for the file that did (provide FEATURE)." |
85370
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
39 (catch 'foundit |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
40 (let ((element (cons 'provide feature))) |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
41 (dolist (x load-history nil) |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
42 (when (member element (cdr x)) |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
43 (throw 'foundit x)))))) |
2543 | 44 |
45 (defun feature-file (feature) | |
46 "Return the file name from which a given FEATURE was loaded. | |
47 Actually, return the load argument, if any; this is sometimes the name of a | |
29090
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
48 Lisp file without an extension. If the feature came from an `eval-buffer' on |
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
49 a buffer with no associated file, or an `eval-region', return nil." |
2543 | 50 (if (not (featurep feature)) |
29090
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
51 (error "%S is not a currently loaded feature" feature) |
2543 | 52 (car (feature-symbols feature)))) |
53 | |
59318
55722dde9e0a
(file-loadhist-lookup): New function.
Richard M. Stallman <rms@gnu.org>
parents:
54000
diff
changeset
|
54 (defun file-loadhist-lookup (file) |
66285
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
55 "Return the `load-history' element for FILE. |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
56 FILE can be a file name, or a library name. |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
57 A library name is equivalent to the file name that `load-library' would load." |
59318
55722dde9e0a
(file-loadhist-lookup): New function.
Richard M. Stallman <rms@gnu.org>
parents:
54000
diff
changeset
|
58 ;; First look for FILE as given. |
55722dde9e0a
(file-loadhist-lookup): New function.
Richard M. Stallman <rms@gnu.org>
parents:
54000
diff
changeset
|
59 (let ((symbols (assoc file load-history))) |
55722dde9e0a
(file-loadhist-lookup): New function.
Richard M. Stallman <rms@gnu.org>
parents:
54000
diff
changeset
|
60 ;; Try converting a library name to an absolute file name. |
55722dde9e0a
(file-loadhist-lookup): New function.
Richard M. Stallman <rms@gnu.org>
parents:
54000
diff
changeset
|
61 (and (null symbols) |
69165
cba71dc12c14
(file-loadhist-lookup): Use `get-load-suffixes' instead of `load-suffixes'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
62 (let ((absname |
cba71dc12c14
(file-loadhist-lookup): Use `get-load-suffixes' instead of `load-suffixes'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
63 (locate-file file load-path (get-load-suffixes)))) |
66285
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
64 (and absname (not (equal absname file)) |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
65 (setq symbols (cdr (assoc absname load-history)))))) |
59318
55722dde9e0a
(file-loadhist-lookup): New function.
Richard M. Stallman <rms@gnu.org>
parents:
54000
diff
changeset
|
66 symbols)) |
55722dde9e0a
(file-loadhist-lookup): New function.
Richard M. Stallman <rms@gnu.org>
parents:
54000
diff
changeset
|
67 |
2543 | 68 (defun file-provides (file) |
66285
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
69 "Return the list of features provided by FILE as it was loaded. |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
70 FILE can be a file name, or a library name. |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
71 A library name is equivalent to the file name that `load-library' would load." |
85370
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
72 (let (provides) |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
73 (dolist (x (file-loadhist-lookup file) provides) |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
74 (when (eq (car-safe x) 'provide) |
87973
b3422590d572
(file-provides, file-requires): Push the filename right.
Richard M. Stallman <rms@gnu.org>
parents:
87649
diff
changeset
|
75 (push (cdr x) provides))))) |
2543 | 76 |
77 (defun file-requires (file) | |
66285
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
78 "Return the list of features required by FILE as it was loaded. |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
79 FILE can be a file name, or a library name. |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
80 A library name is equivalent to the file name that `load-library' would load." |
85370
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
81 (let (requires) |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
82 (dolist (x (file-loadhist-lookup file) requires) |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
83 (when (eq (car-safe x) 'require) |
87973
b3422590d572
(file-provides, file-requires): Push the filename right.
Richard M. Stallman <rms@gnu.org>
parents:
87649
diff
changeset
|
84 (push (cdr x) requires))))) |
2543 | 85 |
29090
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
86 (defsubst file-set-intersect (p q) |
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
87 "Return the set intersection of two lists." |
85370
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
88 (let (ret) |
29090
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
89 (dolist (x p ret) |
85370
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
90 (when (memq x q) (push x ret))))) |
2543 | 91 |
92 (defun file-dependents (file) | |
10498
8fb25f247533
(unload-feature): Don't care if FILE is a dependency of itself.
Richard M. Stallman <rms@gnu.org>
parents:
8108
diff
changeset
|
93 "Return the list of loaded libraries that depend on FILE. |
66285
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
94 This can include FILE itself. |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
95 FILE can be a file name, or a library name. |
dc2f1300400b
(file-loadhist-lookup): Call locate-library
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
96 A library name is equivalent to the file name that `load-library' would load." |
29090
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
97 (let ((provides (file-provides file)) |
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
98 (dependents nil)) |
86d462e378ce
(feature-symbols, file-provides, file-requires): Use mapc.
Dave Love <fx@gnu.org>
parents:
23852
diff
changeset
|
99 (dolist (x load-history dependents) |
85370
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
100 (when (file-set-intersect provides (file-requires (car x))) |
2ad51c213e7d
(feature-symbols, file-provides, file-requires, file-set-intersect,
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
101 (push (car x) dependents))))) |
2543 | 102 |
76968
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
103 (defun read-feature (prompt &optional loaded-p) |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
104 "Read feature name from the minibuffer, prompting with string PROMPT. |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
105 If optional second arg LOADED-P is non-nil, the feature must be loaded |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
106 from a file." |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
107 (intern |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
108 (completing-read prompt |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
109 (cons nil features) |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
110 (and loaded-p |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
111 #'(lambda (f) |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
112 (and f ; ignore nil |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
113 (feature-file f)))) |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
114 loaded-p))) |
16173
9ba176963a26
(read-feature): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
115 |
52755
6c7cae7ce71a
(unload-feature-special-hooks):
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
116 (defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks) |
6c7cae7ce71a
(unload-feature-special-hooks):
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
117 (defvar unload-feature-special-hooks |
79140
c52ee056d7b0
(unload-feature-special-hooks): Update list of special hooks.
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
118 '(after-change-functions after-insert-file-functions |
c52ee056d7b0
(unload-feature-special-hooks): Update list of special hooks.
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
119 after-make-frame-functions auto-fill-function before-change-functions |
98087
02171540ee2a
* loadhist.el (unload-feature-special-hooks):
Juanma Barranquero <lekktu@gmail.com>
parents:
94678
diff
changeset
|
120 blink-paren-function buffer-access-fontify-functions |
02171540ee2a
* loadhist.el (unload-feature-special-hooks):
Juanma Barranquero <lekktu@gmail.com>
parents:
94678
diff
changeset
|
121 choose-completion-string-functions command-line-functions |
79242
70c9d3c324c3
(unload-feature-special-hooks): Add `delete-frame-functions'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79192
diff
changeset
|
122 comment-indent-function compilation-finish-functions delete-frame-functions |
79140
c52ee056d7b0
(unload-feature-special-hooks): Update list of special hooks.
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
123 disabled-command-function find-file-not-found-functions |
c52ee056d7b0
(unload-feature-special-hooks): Update list of special hooks.
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
124 font-lock-beginning-of-syntax-function font-lock-fontify-buffer-function |
c52ee056d7b0
(unload-feature-special-hooks): Update list of special hooks.
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
125 font-lock-fontify-region-function font-lock-mark-block-function |
c52ee056d7b0
(unload-feature-special-hooks): Update list of special hooks.
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
126 font-lock-syntactic-face-function font-lock-unfontify-buffer-function |
c52ee056d7b0
(unload-feature-special-hooks): Update list of special hooks.
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
127 font-lock-unfontify-region-function kill-buffer-query-functions |
c52ee056d7b0
(unload-feature-special-hooks): Update list of special hooks.
Juanma Barranquero <lekktu@gmail.com>
parents:
79030
diff
changeset
|
128 kill-emacs-query-functions lisp-indent-function mouse-position-function |
85740
018f2968e81d
(unload-feature-special-hooks): Add `delete-frame-functions'
Juanma Barranquero <lekktu@gmail.com>
parents:
85688
diff
changeset
|
129 redisplay-end-trigger-functions suspend-tty-functions |
018f2968e81d
(unload-feature-special-hooks): Add `delete-frame-functions'
Juanma Barranquero <lekktu@gmail.com>
parents:
85688
diff
changeset
|
130 temp-buffer-show-function window-scroll-functions |
018f2968e81d
(unload-feature-special-hooks): Add `delete-frame-functions'
Juanma Barranquero <lekktu@gmail.com>
parents:
85688
diff
changeset
|
131 window-size-change-functions write-contents-functions write-file-functions |
47017
0ba62d75345e
(unload-feature): Distinguish functions from variables in load-history.
Richard M. Stallman <rms@gnu.org>
parents:
33094
diff
changeset
|
132 write-region-annotate-functions) |
33094
51c874361c84
(unload-feature): Call elp-restore-function,
Dave Love <fx@gnu.org>
parents:
31674
diff
changeset
|
133 "A list of special hooks from Info node `(elisp)Standard Hooks'. |
22459
bc88a299d2fc
(read-feature): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
16173
diff
changeset
|
134 |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
135 These are symbols with hooklike values whose names don't end in |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
136 `-hook' or `-hooks', from which `unload-feature' should try to remove |
22459
bc88a299d2fc
(read-feature): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
16173
diff
changeset
|
137 pertinent symbols.") |
bc88a299d2fc
(read-feature): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
16173
diff
changeset
|
138 |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
139 (defvar unload-function-defs-list nil |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
140 "List of defintions in the Lisp library being unloaded. |
54000
8d106818ca97
(unload-hook-features-list): New defvar.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53998
diff
changeset
|
141 |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
142 This is meant to be used by `FEATURE-unload-function'; see the |
54000
8d106818ca97
(unload-hook-features-list): New defvar.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53998
diff
changeset
|
143 documentation of `unload-feature' for details.") |
79145
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
144 (define-obsolete-variable-alias 'unload-hook-features-list |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
145 'unload-function-defs-list "22.2") |
54000
8d106818ca97
(unload-hook-features-list): New defvar.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53998
diff
changeset
|
146 |
2543 | 147 ;;;###autoload |
148 (defun unload-feature (feature &optional force) | |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
149 "Unload the library that provided FEATURE. |
29241
a243b2d9c015
(unload-feature): Fix interactive spec [from
Dave Love <fx@gnu.org>
parents:
29090
diff
changeset
|
150 If the feature is required by any other loaded code, and prefix arg FORCE |
53998
2e361a295c26
(unload-feature): Doc fix. Rename flist to unload-hook-features-list.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53599
diff
changeset
|
151 is nil, raise an error. |
2e361a295c26
(unload-feature): Doc fix. Rename flist to unload-hook-features-list.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53599
diff
changeset
|
152 |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
153 Standard unloading activities include restoring old autoloads for |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
154 functions defined by the library, undoing any additions that the |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
155 library has made to hook variables or to `auto-mode-alist', undoing |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
156 ELP profiling of functions in that library, unproviding any features |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
157 provided by the library, and canceling timers held in variables |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
158 defined by the library. |
79030
e8d941fbbe78
(unload-feature): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
159 |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
160 If a function `FEATURE-unload-function' is defined, this function |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
161 calls it with no arguments, before doing anything else. That function |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
162 can do whatever is appropriate to undo the loading of the library. If |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
163 `FEATURE-unload-function' returns non-nil, that suppresses the |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
164 standard unloading of the library. Otherwise the standard unloading |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
165 proceeds. |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
166 |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
167 `FEATURE-unload-function' has access to the package's list of |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
168 definitions in the variable `unload-function-defs-list' and could |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
169 remove symbols from it in the event that the package has done |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
170 something strange, such as redefining an Emacs function." |
76968
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
171 (interactive |
a188649f301c
(read-feature): Reimplement. New optional arg LOADED-P.
Kim F. Storm <storm@cua.dk>
parents:
75797
diff
changeset
|
172 (list |
76969
8237a66e9288
(unload-feature): Add line break.
Kim F. Storm <storm@cua.dk>
parents:
76968
diff
changeset
|
173 (read-feature "Unload feature: " t) |
8237a66e9288
(unload-feature): Add line break.
Kim F. Storm <storm@cua.dk>
parents:
76968
diff
changeset
|
174 current-prefix-arg)) |
61664
79b58e05730b
(unload-feature): Update for new format of load-history. Simplify the code.
Lute Kamstra <lute@gnu.org>
parents:
61599
diff
changeset
|
175 (unless (featurep feature) |
79b58e05730b
(unload-feature): Update for new format of load-history. Simplify the code.
Lute Kamstra <lute@gnu.org>
parents:
61599
diff
changeset
|
176 (error "%s is not a currently loaded feature" (symbol-name feature))) |
79b58e05730b
(unload-feature): Update for new format of load-history. Simplify the code.
Lute Kamstra <lute@gnu.org>
parents:
61599
diff
changeset
|
177 (unless force |
79b58e05730b
(unload-feature): Update for new format of load-history. Simplify the code.
Lute Kamstra <lute@gnu.org>
parents:
61599
diff
changeset
|
178 (let* ((file (feature-file feature)) |
79b58e05730b
(unload-feature): Update for new format of load-history. Simplify the code.
Lute Kamstra <lute@gnu.org>
parents:
61599
diff
changeset
|
179 (dependents (delete file (copy-sequence (file-dependents file))))) |
79b58e05730b
(unload-feature): Update for new format of load-history. Simplify the code.
Lute Kamstra <lute@gnu.org>
parents:
61599
diff
changeset
|
180 (when dependents |
79b58e05730b
(unload-feature): Update for new format of load-history. Simplify the code.
Lute Kamstra <lute@gnu.org>
parents:
61599
diff
changeset
|
181 (error "Loaded libraries %s depend on %s" |
79b58e05730b
(unload-feature): Update for new format of load-history. Simplify the code.
Lute Kamstra <lute@gnu.org>
parents:
61599
diff
changeset
|
182 (prin1-to-string dependents) file)))) |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
183 (let* ((unload-function-defs-list (feature-symbols feature)) |
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
184 (file (pop unload-function-defs-list)) |
75797
1c398694f7b2
(unload-feature): Handle (t . SYMBOL) entries in load history.
Richard M. Stallman <rms@gnu.org>
parents:
75687
diff
changeset
|
185 ;; If non-nil, this is a symbol for which we should |
1c398694f7b2
(unload-feature): Handle (t . SYMBOL) entries in load history.
Richard M. Stallman <rms@gnu.org>
parents:
75687
diff
changeset
|
186 ;; restore a previous autoload if possible. |
1c398694f7b2
(unload-feature): Handle (t . SYMBOL) entries in load history.
Richard M. Stallman <rms@gnu.org>
parents:
75687
diff
changeset
|
187 restore-autoload |
79145
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
188 (name (symbol-name feature)) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
189 (unload-hook (intern-soft (concat name "-unload-hook"))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
190 (unload-func (intern-soft (concat name "-unload-function")))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
191 ;; If FEATURE-unload-function is defined and returns non-nil, |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
192 ;; don't try to do anything more; otherwise proceed normally. |
79270
6dd30931fca5
(unload-feature): Remove redundant check.
Juanma Barranquero <lekktu@gmail.com>
parents:
79254
diff
changeset
|
193 (unless (and (fboundp unload-func) |
79145
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
194 (funcall unload-func)) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
195 ;; Try to avoid losing badly when hooks installed in critical |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
196 ;; places go away. (Some packages install things on |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
197 ;; `kill-buffer-hook', `activate-menubar-hook' and the like.) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
198 (if unload-hook |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
199 ;; First off, provide a clean way for package FOO to arrange |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
200 ;; this by adding hooks on the variable `FOO-unload-hook'. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
201 ;; This is obsolete; FEATURE-unload-function should be used now. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
202 (run-hooks unload-hook) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
203 ;; Otherwise, do our best. Look through the obarray for symbols |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
204 ;; which seem to be hook variables or special hook functions and |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
205 ;; remove anything from them which matches the feature-symbols |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
206 ;; about to get zapped. Obviously this won't get anonymous |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
207 ;; functions which the package might just have installed, and |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
208 ;; there might be other important state, but this tactic |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
209 ;; normally works. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
210 (mapatoms |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
211 (lambda (x) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
212 (when (and (boundp x) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
213 (or (and (consp (symbol-value x)) ; Random hooks. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
214 (string-match "-hooks?\\'" (symbol-name x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
215 (memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
216 (dolist (y unload-function-defs-list) |
79145
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
217 (when (and (eq (car-safe y) 'defun) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
218 (not (get (cdr y) 'autoload))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
219 (remove-hook x (cdr y))))))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
220 ;; Remove any feature-symbols from auto-mode-alist as well. |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
221 (dolist (y unload-function-defs-list) |
79145
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
222 (when (and (eq (car-safe y) 'defun) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
223 (not (get (cdr y) 'autoload))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
224 (setq auto-mode-alist |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
225 (rassq-delete-all (cdr y) auto-mode-alist))))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
226 (when (fboundp 'elp-restore-function) ; remove ELP stuff first |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
227 (dolist (elt unload-function-defs-list) |
79145
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
228 (when (symbolp elt) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
229 (elp-restore-function elt)))) |
75797
1c398694f7b2
(unload-feature): Handle (t . SYMBOL) entries in load history.
Richard M. Stallman <rms@gnu.org>
parents:
75687
diff
changeset
|
230 |
79192
8f2e292b71d0
(unload-function-defs-list): Renamed from unload-function-features-list.
Richard M. Stallman <rms@gnu.org>
parents:
79145
diff
changeset
|
231 (dolist (x unload-function-defs-list) |
79145
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
232 (if (consp x) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
233 (case (car x) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
234 ;; Remove any feature names that this file provided. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
235 (provide |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
236 (setq features (delq (cdr x) features))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
237 ((defun autoload) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
238 (let ((fun (cdr x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
239 (when (fboundp fun) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
240 (when (fboundp 'ad-unadvise) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
241 (ad-unadvise fun)) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
242 (let ((aload (get fun 'autoload))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
243 (if (and aload (eq fun restore-autoload)) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
244 (fset fun (cons 'autoload aload)) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
245 (fmakunbound fun)))))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
246 ;; (t . SYMBOL) comes before (defun . SYMBOL) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
247 ;; and says we should restore SYMBOL's autoload |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
248 ;; when we undefine it. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
249 ((t) (setq restore-autoload (cdr x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
250 ((require defface) nil) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
251 (t (message "Unexpected element %s in load-history" x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
252 ;; Kill local values as much as possible. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
253 (dolist (buf (buffer-list)) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
254 (with-current-buffer buf |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
255 (if (and (boundp x) (timerp (symbol-value x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
256 (cancel-timer (symbol-value x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
257 (kill-local-variable x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
258 (if (and (boundp x) (timerp (symbol-value x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
259 (cancel-timer (symbol-value x))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
260 ;; Get rid of the default binding if we can. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
261 (unless (local-variable-if-set-p x) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
262 (makunbound x)))) |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
263 ;; Delete the load-history element for this file. |
e635cd6341e6
(unload-function-features-list): Rename from `unload-hook-features-list'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79140
diff
changeset
|
264 (setq load-history (delq (assoc file load-history) load-history)))) |
75687
8cf73d911b65
(unload-feature): Silently ignore `load-history' entries of the form `(defface
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
265 ;; Don't return load-history, it is not useful. |
8cf73d911b65
(unload-feature): Silently ignore `load-history' entries of the form `(defface
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
266 nil) |
2543 | 267 |
268 (provide 'loadhist) | |
269 | |
69935
3fc0524ae318
(unload-feature): A bit of sanity check of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69165
diff
changeset
|
270 ;; arch-tag: 70bb846a-c413-4f01-bf88-78dba4ac0798 |
2543 | 271 ;;; loadhist.el ends here |