emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8eb9416: Be more defensive regarding elements of 'l


From: Eli Zaretskii
Subject: [Emacs-diffs] master 8eb9416: Be more defensive regarding elements of 'load-history'
Date: Fri, 1 Mar 2019 04:46:15 -0500 (EST)

branch: master
commit 8eb94161b3419f3dd345871928ea37d986791963
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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)
---
 lisp/apropos.el            | 2 +-
 lisp/emacs-lisp/package.el | 3 ++-
 lisp/help-fns.el           | 4 ++--
 lisp/loadhist.el           | 3 ++-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/apropos.el b/lisp/apropos.el
index 6614645..1b86f5b 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -681,7 +681,7 @@ the output includes key-bindings of commands."
             (re (concat "\\(?:\\`\\|[\\/]\\)" (regexp-quote file)
                         "\\(\\.\\|\\'\\)")))
         (while (and lh (null lh-entry))
-          (if (and (caar lh) (string-match re (caar lh)))
+          (if (and (stringp (caar lh)) (string-match re (caar lh)))
               (setq lh-entry (car lh))
             (setq lh (cdr lh)))))
       (unless lh-entry (error "Unknown library `%s'" file)))
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 458bfad..5e8864e 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -756,7 +756,8 @@ DIR, sorted by most recently loaded last."
   (let* ((history (delq nil
                         (mapcar (lambda (x)
                                   (let ((f (car x)))
-                                    (and f (file-name-sans-extension f))))
+                                    (and (stringp f)
+                                         (file-name-sans-extension f))))
                                 load-history)))
          (dir (file-truename dir))
          ;; List all files that have already been loaded.
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index b4e93d3..06b4ec8 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -76,7 +76,7 @@ The functions will receive the function name as argument.")
       (let* ((re (load-history-regexp file))
              (done nil))
         (dolist (x load-history)
-          (and (car x) (string-match-p re (car x)) (setq done t)))
+          (and (stringp (car x)) (string-match-p re (car x)) (setq done t)))
         done)))
 
 (defun help--load-prefixes (prefixes)
@@ -521,7 +521,7 @@ FILE is the file where FUNCTION was probably defined."
         (target (cons t function))
         found)
     (while (and load-hist (not found))
-      (and (caar load-hist)
+      (and (stringp (caar load-hist))
           (equal (file-name-sans-extension (caar load-hist)) file)
           (setq found (member target (cdar load-hist))))
       (setq load-hist (cdr load-hist)))
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 5070a00..4e5d8e0 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."
   (let ((provides (file-provides file))
        (dependents nil))
     (dolist (x load-history dependents)
-      (when (file-set-intersect provides (file-requires (car x)))
+      (when (and (stringp (car x))
+                 (file-set-intersect provides (file-requires (car x))))
        (push (car x) dependents)))))
 
 (defun read-feature (prompt &optional loaded-p)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]