all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* apropos-library: Check for null library in load-history
@ 2009-02-11 22:16 Daniel Jensen
  2009-02-11 22:47 ` Daniel Jensen
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jensen @ 2009-02-11 22:16 UTC (permalink / raw)
  To: emacs-devel

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

--- emacs/lisp/apropos.el       2009-01-05 04:18:41.000000000 +0100
+++ emacs-mod/lisp/apropos.el   2009-02-11 22:58:19.000000000 +0100
@@ -573,11 +573,12 @@
           (nconc (delq nil
                        (mapcar
                         (lambda (l)
-                          (setq l (file-name-nondirectory l))
-                          (while
-                              (not (equal (setq l (file-name-sans-extension l))
-                                          l)))
-                          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))))
      (list (completing-read "Describe library: " libs nil t))))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: apropos-library: Check for null library in load-history
  2009-02-11 22:16 apropos-library: Check for null library in load-history Daniel Jensen
@ 2009-02-11 22:47 ` Daniel Jensen
  2009-02-15 22:01   ` Daniel Jensen
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jensen @ 2009-02-11 22:47 UTC (permalink / raw)
  To: emacs-devel

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)))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: apropos-library: Check for null library in load-history
  2009-02-11 22:47 ` Daniel Jensen
@ 2009-02-15 22:01   ` Daniel Jensen
  2009-02-20  6:04     ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jensen @ 2009-02-15 22:01 UTC (permalink / raw)
  To: emacs-devel

Here's a more detailed report. Sorry for not having used report-emacs-bug.

My Emacs version is GNU Emacs 23.0.90.1 (i686-pc-linux-gnu, GTK+ Version
2.8.20) of 2009-02-08

To trigger the bug, type the following in the *scratch* buffer:

(defun foo ())
M-x eval-buffer RET
M-x apropos-library RET

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-nondirectory(nil)
  (setq l (file-name-nondirectory l))
  (lambda (l) (setq l (file-name-nondirectory l)) (while (not ...)) l)(nil)
  mapcar((lambda (l) (setq l (file-name-nondirectory l)) (while (not ...)) l) (...))
  (delq nil (mapcar (lambda ... ... ... l) (mapcar ... load-history)))
  (nconc (delq nil (mapcar ... ...)) (mapcar (quote car) load-history))
  (let ((libs ...)) (list (completing-read "Describe library: " libs nil t)))
  call-interactively(apropos-library t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

I hope this helps.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: apropos-library: Check for null library in load-history
  2009-02-15 22:01   ` Daniel Jensen
@ 2009-02-20  6:04     ` Glenn Morris
  0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2009-02-20  6:04 UTC (permalink / raw)
  To: emacs-devel


Thanks, I installed something similar.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-20  6:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-11 22:16 apropos-library: Check for null library in load-history Daniel Jensen
2009-02-11 22:47 ` Daniel Jensen
2009-02-15 22:01   ` Daniel Jensen
2009-02-20  6:04     ` Glenn Morris

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.