summaryrefslogtreecommitdiff
path: root/lisp/loadhist.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2007-04-06 17:03:19 +0000
committerKim F. Storm <storm@cua.dk>2007-04-06 17:03:19 +0000
commit12d9b59e7a4e1320f5c6dc83582ec94e91da758f (patch)
tree99e0c95fe3db38ce42964e968ef1e7918df55870 /lisp/loadhist.el
parentba8357c877a9f49ded46b0b219cf518b0b6b0fee (diff)
downloademacs-12d9b59e7a4e1320f5c6dc83582ec94e91da758f.tar.gz
(read-feature): Reimplement. New optional arg LOADED-P.
(unload-feature): Update interactive spec accordingly.
Diffstat (limited to 'lisp/loadhist.el')
-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."
(setq dependents (cons (car x) dependents))))
dependents))
-(defun read-feature (prompt)
- "Read a feature name \(string\) from the minibuffer.
-Prompt with PROMPT and completing from `features', and
-return the feature \(symbol\)."
- (intern (completing-read prompt
- (mapcar (lambda (feature)
- (list (symbol-name feature)))
- features)
- ;; Complete only features loaded from a file
- #'(lambda (f) (feature-file (intern (car f))))
- t)))
+(defun read-feature (prompt &optional loaded-p)
+ "Read feature name from the minibuffer, prompting with string PROMPT.
+If optional second arg LOADED-P is non-nil, the feature must be loaded
+from a file."
+ (intern
+ (completing-read prompt
+ (cons nil features)
+ (and loaded-p
+ #'(lambda (f)
+ (and f ; ignore nil
+ (feature-file f))))
+ loaded-p)))
(defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks)
(defvar unload-feature-special-hooks
@@ -162,7 +163,9 @@ the package's feature list (before anything is unbound) in the
variable `unload-hook-features-list' and could remove features from it
in the event that the package has done something normally-ill-advised,
such as redefining an Emacs function."
- (interactive (list (read-feature "Feature: ") current-prefix-arg))
+ (interactive
+ (list
+ (read-feature "Unload feature: " t) current-prefix-arg))
(unless (featurep feature)
(error "%s is not a currently loaded feature" (symbol-name feature)))
(unless force