diff lisp/emacs-lisp/find-func.el @ 94181:959a3833d833

* files.el (locate-file-completion-table): Rename from locate-file-completion and make it use `pred' in the normal way. (locate-file-completion): New compatibility wrapper. (load-library): Use locate-file-completion-table. * emacs-lisp/find-func.el (find-library): Likewise. * info.el: Use with-current-buffer and inhibit-read-only. (Info-read-node-name-2): Change to use `predicate' in the normal way. (Info-read-node-name-1): Adjust uses accordingly.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 19 Apr 2008 03:33:13 +0000
parents 54e63ce02006
children 90a2847062be
line wrap: on
line diff
--- a/lisp/emacs-lisp/find-func.el	Sat Apr 19 03:23:15 2008 +0000
+++ b/lisp/emacs-lisp/find-func.el	Sat Apr 19 03:33:13 2008 +0000
@@ -197,8 +197,8 @@
 (defun find-library (library)
   "Find the elisp source of LIBRARY."
   (interactive
-   (let* ((path (cons (or find-function-source-path load-path)
-		      (find-library-suffixes)))
+   (let* ((dirs (or find-function-source-path load-path))
+          (suffixes (find-library-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
@@ -213,11 +213,15 @@
 		     (error nil))
 		 (thing-at-point 'symbol))))
      (when def
-       (setq def (and (locate-file-completion def path 'test) def)))
+       (setq def (and (locate-file-completion-table
+                       dirs suffixes def nil 'lambda)
+                      def)))
      (list
       (completing-read (if def (format "Library name (default %s): " def)
 			 "Library name: ")
-		       'locate-file-completion path nil nil nil def))))
+		       (apply-partially 'locate-file-completion-table
+                                        dirs suffixes)
+                       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)))))