diff options
| author | Eli Zaretskii | 2019-03-01 11:44:52 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2019-03-01 11:44:52 +0200 |
| commit | 8eb94161b3419f3dd345871928ea37d986791963 (patch) | |
| tree | 0f0d5f78d2e90d413bc7d92de49cce6b80892d4c | |
| parent | cb95d771a230716562b359c6a49e8ae1b822af14 (diff) | |
| download | emacs-8eb94161b3419f3dd345871928ea37d986791963.tar.gz emacs-8eb94161b3419f3dd345871928ea37d986791963.zip | |
Be more defensive regarding elements of 'load-history'
* lisp/loadhist.el (file-dependents):
* lisp/apropos.el (apropos-library):
* lisp/help-fns.el (help-fns--autoloaded-p, help--loaded-p):
* lisp/emacs-lisp/package.el (package--list-loaded-files):
Don't assume 'load-history' elements must have a string as their
'car'. (Bug#34462)
| -rw-r--r-- | lisp/apropos.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 3 | ||||
| -rw-r--r-- | lisp/help-fns.el | 4 | ||||
| -rw-r--r-- | lisp/loadhist.el | 3 |
4 files changed, 7 insertions, 5 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el index 6614645f74e..1b86f5bcde3 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el | |||
| @@ -681,7 +681,7 @@ the output includes key-bindings of commands." | |||
| 681 | (re (concat "\\(?:\\`\\|[\\/]\\)" (regexp-quote file) | 681 | (re (concat "\\(?:\\`\\|[\\/]\\)" (regexp-quote file) |
| 682 | "\\(\\.\\|\\'\\)"))) | 682 | "\\(\\.\\|\\'\\)"))) |
| 683 | (while (and lh (null lh-entry)) | 683 | (while (and lh (null lh-entry)) |
| 684 | (if (and (caar lh) (string-match re (caar lh))) | 684 | (if (and (stringp (caar lh)) (string-match re (caar lh))) |
| 685 | (setq lh-entry (car lh)) | 685 | (setq lh-entry (car lh)) |
| 686 | (setq lh (cdr lh))))) | 686 | (setq lh (cdr lh))))) |
| 687 | (unless lh-entry (error "Unknown library `%s'" file))) | 687 | (unless lh-entry (error "Unknown library `%s'" file))) |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 458bfad3279..5e8864ec73f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -756,7 +756,8 @@ DIR, sorted by most recently loaded last." | |||
| 756 | (let* ((history (delq nil | 756 | (let* ((history (delq nil |
| 757 | (mapcar (lambda (x) | 757 | (mapcar (lambda (x) |
| 758 | (let ((f (car x))) | 758 | (let ((f (car x))) |
| 759 | (and f (file-name-sans-extension f)))) | 759 | (and (stringp f) |
| 760 | (file-name-sans-extension f)))) | ||
| 760 | load-history))) | 761 | load-history))) |
| 761 | (dir (file-truename dir)) | 762 | (dir (file-truename dir)) |
| 762 | ;; List all files that have already been loaded. | 763 | ;; List all files that have already been loaded. |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index b4e93d36d4c..06b4ec8c209 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -76,7 +76,7 @@ The functions will receive the function name as argument.") | |||
| 76 | (let* ((re (load-history-regexp file)) | 76 | (let* ((re (load-history-regexp file)) |
| 77 | (done nil)) | 77 | (done nil)) |
| 78 | (dolist (x load-history) | 78 | (dolist (x load-history) |
| 79 | (and (car x) (string-match-p re (car x)) (setq done t))) | 79 | (and (stringp (car x)) (string-match-p re (car x)) (setq done t))) |
| 80 | done))) | 80 | done))) |
| 81 | 81 | ||
| 82 | (defun help--load-prefixes (prefixes) | 82 | (defun help--load-prefixes (prefixes) |
| @@ -521,7 +521,7 @@ FILE is the file where FUNCTION was probably defined." | |||
| 521 | (target (cons t function)) | 521 | (target (cons t function)) |
| 522 | found) | 522 | found) |
| 523 | (while (and load-hist (not found)) | 523 | (while (and load-hist (not found)) |
| 524 | (and (caar load-hist) | 524 | (and (stringp (caar load-hist)) |
| 525 | (equal (file-name-sans-extension (caar load-hist)) file) | 525 | (equal (file-name-sans-extension (caar load-hist)) file) |
| 526 | (setq found (member target (cdar load-hist)))) | 526 | (setq found (member target (cdar load-hist)))) |
| 527 | (setq load-hist (cdr load-hist))) | 527 | (setq load-hist (cdr load-hist))) |
diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 5070a00aaf5..4e5d8e0f38d 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el | |||
| @@ -96,7 +96,8 @@ A library name is equivalent to the file name that `load-library' would load." | |||
| 96 | (let ((provides (file-provides file)) | 96 | (let ((provides (file-provides file)) |
| 97 | (dependents nil)) | 97 | (dependents nil)) |
| 98 | (dolist (x load-history dependents) | 98 | (dolist (x load-history dependents) |
| 99 | (when (file-set-intersect provides (file-requires (car x))) | 99 | (when (and (stringp (car x)) |
| 100 | (file-set-intersect provides (file-requires (car x)))) | ||
| 100 | (push (car x) dependents))))) | 101 | (push (car x) dependents))))) |
| 101 | 102 | ||
| 102 | (defun read-feature (prompt &optional loaded-p) | 103 | (defun read-feature (prompt &optional loaded-p) |