diff options
| author | Kim F. Storm | 2007-04-06 17:03:19 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2007-04-06 17:03:19 +0000 |
| commit | 12d9b59e7a4e1320f5c6dc83582ec94e91da758f (patch) | |
| tree | 99e0c95fe3db38ce42964e968ef1e7918df55870 | |
| parent | ba8357c877a9f49ded46b0b219cf518b0b6b0fee (diff) | |
| download | emacs-12d9b59e7a4e1320f5c6dc83582ec94e91da758f.tar.gz emacs-12d9b59e7a4e1320f5c6dc83582ec94e91da758f.zip | |
(read-feature): Reimplement. New optional arg LOADED-P.
(unload-feature): Update interactive spec accordingly.
| -rw-r--r-- | lisp/loadhist.el | 27 |
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. |
| 116 | Prompt with PROMPT and completing from `features', and | 116 | If optional second arg LOADED-P is non-nil, the feature must be loaded |
| 117 | return the feature \(symbol\)." | 117 | from 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 | |||
| 162 | variable `unload-hook-features-list' and could remove features from it | 163 | variable `unload-hook-features-list' and could remove features from it |
| 163 | in the event that the package has done something normally-ill-advised, | 164 | in the event that the package has done something normally-ill-advised, |
| 164 | such as redefining an Emacs function." | 165 | such 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 |