diff options
| author | Juanma Barranquero | 2007-10-17 23:05:54 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2007-10-17 23:05:54 +0000 |
| commit | b5307e9c2bd6222f9af6a6792ae69f3bb45fdf45 (patch) | |
| tree | 6785e4802822a2c4f52d8a4e39ae87ce10f81553 | |
| parent | 640602f766d7431ae40ac5ffa274db405b1c4d7d (diff) | |
| download | emacs-b5307e9c2bd6222f9af6a6792ae69f3bb45fdf45.tar.gz emacs-b5307e9c2bd6222f9af6a6792ae69f3bb45fdf45.zip | |
(feature-symbols, file-provides, file-requires, file-set-intersect,
file-dependents): Simplify.
(unload-feature-special-hooks): Update list of special hooks.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/loadhist.el | 61 |
2 files changed, 35 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d6b0dd86cac..9e7dd58d79d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2007-10-17 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * loadhist.el (feature-symbols, file-provides, file-requires) | ||
| 4 | (file-set-intersect, file-dependents): Simplify. | ||
| 5 | (unload-feature-special-hooks): Update list of special hooks. | ||
| 6 | |||
| 1 | 2007-10-17 Tassilo Horn <tassilo@member.fsf.org> | 7 | 2007-10-17 Tassilo Horn <tassilo@member.fsf.org> |
| 2 | 8 | ||
| 3 | * bindings.el (completion-ignored-extensions): Remove pdf and dvi | 9 | * bindings.el (completion-ignored-extensions): Remove pdf and dvi |
| @@ -11,7 +17,7 @@ | |||
| 11 | text and image display. Add binding C-c C-e to switch to an | 17 | text and image display. Add binding C-c C-e to switch to an |
| 12 | editing mode. | 18 | editing mode. |
| 13 | (doc-view-ghostscript-options, doc-view-ps->pdf): Add "-dSAFER" to | 19 | (doc-view-ghostscript-options, doc-view-ps->pdf): Add "-dSAFER" to |
| 14 | avoid security problems when rendering files untrusted sources. | 20 | avoid security problems when rendering files from untrusted sources. |
| 15 | 21 | ||
| 16 | 2007-10-17 Aaron Hawley <aaronh@garden.org> | 22 | 2007-10-17 Aaron Hawley <aaronh@garden.org> |
| 17 | 23 | ||
diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 4e9ee480d65..95de0d822a3 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el | |||
| @@ -38,12 +38,11 @@ | |||
| 38 | "Return the file and list of definitions associated with FEATURE. | 38 | "Return the file and list of definitions associated with FEATURE. |
| 39 | The value is actually the element of `load-history' | 39 | The value is actually the element of `load-history' |
| 40 | for the file that did (provide FEATURE)." | 40 | for the file that did (provide FEATURE)." |
| 41 | (catch 'foundit | 41 | (catch 'foundit |
| 42 | (mapc (lambda (x) | 42 | (let ((element (cons 'provide feature))) |
| 43 | (if (member (cons 'provide feature) (cdr x)) | 43 | (dolist (x load-history nil) |
| 44 | (throw 'foundit x))) | 44 | (when (member element (cdr x)) |
| 45 | load-history) | 45 | (throw 'foundit x)))))) |
| 46 | nil)) | ||
| 47 | 46 | ||
| 48 | (defun feature-file (feature) | 47 | (defun feature-file (feature) |
| 49 | "Return the file name from which a given FEATURE was loaded. | 48 | "Return the file name from which a given FEATURE was loaded. |
| @@ -72,32 +71,25 @@ A library name is equivalent to the file name that `load-library' would load." | |||
| 72 | "Return the list of features provided by FILE as it was loaded. | 71 | "Return the list of features provided by FILE as it was loaded. |
| 73 | FILE can be a file name, or a library name. | 72 | FILE can be a file name, or a library name. |
| 74 | A library name is equivalent to the file name that `load-library' would load." | 73 | A library name is equivalent to the file name that `load-library' would load." |
| 75 | (let ((symbols (file-loadhist-lookup file)) | 74 | (let (provides) |
| 76 | provides) | 75 | (dolist (x (file-loadhist-lookup file) provides) |
| 77 | (mapc (lambda (x) | 76 | (when (eq (car-safe x) 'provide) |
| 78 | (if (and (consp x) (eq (car x) 'provide)) | 77 | (push x provides))))) |
| 79 | (setq provides (cons (cdr x) provides)))) | ||
| 80 | symbols) | ||
| 81 | provides)) | ||
| 82 | 78 | ||
| 83 | (defun file-requires (file) | 79 | (defun file-requires (file) |
| 84 | "Return the list of features required by FILE as it was loaded. | 80 | "Return the list of features required by FILE as it was loaded. |
| 85 | FILE can be a file name, or a library name. | 81 | FILE can be a file name, or a library name. |
| 86 | A library name is equivalent to the file name that `load-library' would load." | 82 | A library name is equivalent to the file name that `load-library' would load." |
| 87 | (let ((symbols (file-loadhist-lookup file)) | 83 | (let (requires) |
| 88 | requires) | 84 | (dolist (x (file-loadhist-lookup file) requires) |
| 89 | (mapc (lambda (x) | 85 | (when (eq (car-safe x) 'require) |
| 90 | (if (and (consp x) (eq (car x) 'require)) | 86 | (push x requires))))) |
| 91 | (setq requires (cons (cdr x) requires)))) | ||
| 92 | symbols) | ||
| 93 | requires)) | ||
| 94 | 87 | ||
| 95 | (defsubst file-set-intersect (p q) | 88 | (defsubst file-set-intersect (p q) |
| 96 | "Return the set intersection of two lists." | 89 | "Return the set intersection of two lists." |
| 97 | (let ((ret nil)) | 90 | (let (ret) |
| 98 | (dolist (x p ret) | 91 | (dolist (x p ret) |
| 99 | (if (memq x q) (setq ret (cons x ret)))) | 92 | (when (memq x q) (push x ret))))) |
| 100 | ret)) | ||
| 101 | 93 | ||
| 102 | (defun file-dependents (file) | 94 | (defun file-dependents (file) |
| 103 | "Return the list of loaded libraries that depend on FILE. | 95 | "Return the list of loaded libraries that depend on FILE. |
| @@ -107,9 +99,8 @@ A library name is equivalent to the file name that `load-library' would load." | |||
| 107 | (let ((provides (file-provides file)) | 99 | (let ((provides (file-provides file)) |
| 108 | (dependents nil)) | 100 | (dependents nil)) |
| 109 | (dolist (x load-history dependents) | 101 | (dolist (x load-history dependents) |
| 110 | (if (file-set-intersect provides (file-requires (car x))) | 102 | (when (file-set-intersect provides (file-requires (car x))) |
| 111 | (setq dependents (cons (car x) dependents)))) | 103 | (push (car x) dependents))))) |
| 112 | dependents)) | ||
| 113 | 104 | ||
| 114 | (defun read-feature (prompt &optional loaded-p) | 105 | (defun read-feature (prompt &optional loaded-p) |
| 115 | "Read feature name from the minibuffer, prompting with string PROMPT. | 106 | "Read feature name from the minibuffer, prompting with string PROMPT. |
| @@ -126,15 +117,19 @@ from a file." | |||
| 126 | 117 | ||
| 127 | (defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks) | 118 | (defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks) |
| 128 | (defvar unload-feature-special-hooks | 119 | (defvar unload-feature-special-hooks |
| 129 | '(after-change-functions | 120 | '(after-change-functions after-insert-file-functions |
| 130 | after-insert-file-functions auto-fill-function | 121 | after-make-frame-functions auto-fill-function before-change-functions |
| 131 | before-change-functions blink-paren-function | 122 | blink-paren-function buffer-access-fontify-functions command-line-functions |
| 132 | buffer-access-fontify-functions command-line-functions | 123 | comment-indent-function compilation-finish-functions |
| 133 | comment-indent-function kill-buffer-query-functions | 124 | disabled-command-function find-file-not-found-functions |
| 134 | kill-emacs-query-functions lisp-indent-function | 125 | font-lock-beginning-of-syntax-function font-lock-fontify-buffer-function |
| 135 | mouse-position-function | 126 | font-lock-fontify-region-function font-lock-mark-block-function |
| 127 | font-lock-syntactic-face-function font-lock-unfontify-buffer-function | ||
| 128 | font-lock-unfontify-region-function kill-buffer-query-functions | ||
| 129 | kill-emacs-query-functions lisp-indent-function mouse-position-function | ||
| 136 | redisplay-end-trigger-functions temp-buffer-show-function | 130 | redisplay-end-trigger-functions temp-buffer-show-function |
| 137 | window-scroll-functions window-size-change-functions | 131 | window-scroll-functions window-size-change-functions |
| 132 | write-contents-functions write-file-functions | ||
| 138 | write-region-annotate-functions) | 133 | write-region-annotate-functions) |
| 139 | "A list of special hooks from Info node `(elisp)Standard Hooks'. | 134 | "A list of special hooks from Info node `(elisp)Standard Hooks'. |
| 140 | 135 | ||