emacs-devel
[Top][All Lists]
Advanced

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

Re: apropos-library: Check for null library in load-history


From: Daniel Jensen
Subject: Re: apropos-library: Check for null library in load-history
Date: Wed, 11 Feb 2009 23:47:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.90 (gnu/linux)

I wrote:

> apropos-library does not handle a null library name in load-history
> correctly. This patch fixes the problem.

Actually this still leaves `nil' in the completion collection. There was
also another bug that I missed in the first patch. Here's another one.

--- emacs/lisp/apropos.el       2009-01-05 04:18:41.000000000 +0100
+++ emacs-mod/lisp/apropos.el   2009-02-11 23:43:12.000000000 +0100
@@ -570,16 +570,17 @@
 thus be found in `load-history'."
   (interactive
    (let ((libs
-          (nconc (delq nil
-                       (mapcar
-                        (lambda (l)
+          (delq nil (nconc
+                     (mapcar
+                      (lambda (l)
+                        (when (stringp l)
                           (setq l (file-name-nondirectory l))
                           (while
                               (not (equal (setq l (file-name-sans-extension l))
                                           l)))
-                          l)
-                        (mapcar 'car load-history)))
-                 (mapcar 'car load-history))))
+                          l))
+                      (mapcar 'car load-history))
+                     (mapcar 'car load-history)))))
      (list (completing-read "Describe library: " libs nil t))))
   (let ((symbols nil)
        ;; (autoloads nil)
@@ -592,7 +593,7 @@
             (re (concat "\\(?:\\`\\|[\\/]\\)" (regexp-quote file)
                         "\\(\\.\\|\\'\\)")))
         (while (and lh (null lh-entry))
-          (if (string-match re (caar lh))
+          (if (and (caar lh) (string-match re (caar lh)))
               (setq lh-entry (car lh))
             (setq lh (cdr lh)))))
       (unless lh-entry (error "Unknown library `%s'" file)))





reply via email to

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