[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/subr.el
From: |
Romain Francoise |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/subr.el |
Date: |
Fri, 28 Oct 2005 12:55:52 -0400 |
Index: emacs/lisp/subr.el
diff -c emacs/lisp/subr.el:1.484 emacs/lisp/subr.el:1.485
*** emacs/lisp/subr.el:1.484 Sat Oct 22 17:34:48 2005
--- emacs/lisp/subr.el Fri Oct 28 16:55:47 2005
***************
*** 1309,1314 ****
--- 1309,1342 ----
(setq files (cdr files)))
file)))
+ ;;;###autoload
+ (defun locate-library (library &optional nosuffix path interactive-call)
+ "Show the precise file name of Emacs library LIBRARY.
+ This command searches the directories in `load-path' like `\\[load-library]'
+ to find the file that `\\[load-library] RET LIBRARY RET' would load.
+ Optional second arg NOSUFFIX non-nil means don't add suffixes `load-suffixes'
+ to the specified name LIBRARY.
+
+ If the optional third arg PATH is specified, that list of directories
+ is used instead of `load-path'.
+
+ When called from a program, the file name is normaly returned as a
+ string. When run interactively, the argument INTERACTIVE-CALL is t,
+ and the file name is displayed in the echo area."
+ (interactive (list (completing-read "Locate library: "
+ 'locate-file-completion
+ (cons load-path load-suffixes))
+ nil nil
+ t))
+ (let ((file (locate-file library
+ (or path load-path)
+ (append (unless nosuffix load-suffixes) '("")))))
+ (if interactive-call
+ (if file
+ (message "Library is file %s" (abbreviate-file-name file))
+ (message "No library %s in search path" library)))
+ file))
+
;;;; Specifying things to do later.