aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/loadhist.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 39d51a280f5..35b010074d0 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -111,17 +111,18 @@ A library name is equivalent to the file name that `load-library' would load."
111 (setq dependents (cons (car x) dependents)))) 111 (setq dependents (cons (car x) dependents))))
112 dependents)) 112 dependents))
113 113
114(defun read-feature (prompt) 114(defun read-feature (prompt &optional loaded-p)
115 "Read a feature name \(string\) from the minibuffer. 115 "Read feature name from the minibuffer, prompting with string PROMPT.
116Prompt with PROMPT and completing from `features', and 116If optional second arg LOADED-P is non-nil, the feature must be loaded
117return the feature \(symbol\)." 117from a file."
118 (intern (completing-read prompt 118 (intern
119 (mapcar (lambda (feature) 119 (completing-read prompt
120 (list (symbol-name feature))) 120 (cons nil features)
121 features) 121 (and loaded-p
122 ;; Complete only features loaded from a file 122 #'(lambda (f)
123 #'(lambda (f) (feature-file (intern (car f)))) 123 (and f ; ignore nil
124 t))) 124 (feature-file f))))
125 loaded-p)))
125 126
126(defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks) 127(defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks)
127(defvar unload-feature-special-hooks 128(defvar unload-feature-special-hooks
@@ -162,7 +163,9 @@ the package's feature list (before anything is unbound) in the
162variable `unload-hook-features-list' and could remove features from it 163variable `unload-hook-features-list' and could remove features from it
163in the event that the package has done something normally-ill-advised, 164in the event that the package has done something normally-ill-advised,
164such as redefining an Emacs function." 165such as redefining an Emacs function."
165 (interactive (list (read-feature "Feature: ") current-prefix-arg)) 166 (interactive
167 (list
168 (read-feature "Unload feature: " t) current-prefix-arg))
166 (unless (featurep feature) 169 (unless (featurep feature)
167 (error "%s is not a currently loaded feature" (symbol-name feature))) 170 (error "%s is not a currently loaded feature" (symbol-name feature)))
168 (unless force 171 (unless force