diff lisp/emacs-lisp/find-func.el @ 111084:8c55e138333b

* lisp/emacs-lisp/find-func.el (find-library): Use test-completion.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 21 Oct 2010 23:17:26 -0400
parents 1d1d5d9bd884
children 417b1e4d63cd
line wrap: on
line diff
--- a/lisp/emacs-lisp/find-func.el	Fri Oct 22 01:39:13 2010 +0000
+++ b/lisp/emacs-lisp/find-func.el	Thu Oct 21 23:17:26 2010 -0400
@@ -213,6 +213,8 @@
   (interactive
    (let* ((dirs (or find-function-source-path load-path))
           (suffixes (find-library-suffixes))
+          (table (apply-partially 'locate-file-completion-table
+                                  dirs suffixes))
 	  (def (if (eq (function-called-at-point) 'require)
 		   ;; `function-called-at-point' may return 'require
 		   ;; with `point' anywhere on this line.  So wrap the
@@ -226,16 +228,12 @@
 			 (thing-at-point 'symbol))
 		     (error nil))
 		 (thing-at-point 'symbol))))
-     (when def
-       (setq def (and (locate-file-completion-table
-                       dirs suffixes def nil 'lambda)
-                      def)))
+     (when (and def (not (test-completion def table)))
+       (setq def nil))
      (list
       (completing-read (if def (format "Library name (default %s): " def)
 			 "Library name: ")
-		       (apply-partially 'locate-file-completion-table
-                                        dirs suffixes)
-                       nil nil nil nil def))))
+		       table nil nil nil nil def))))
   (let ((buf (find-file-noselect (find-library-name library))))
     (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf)))))