comparison lisp/emacs-lisp/find-func.el @ 101934:9bfebe85710d

(find-library-name, find-library): Doc fixes.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 11 Feb 2009 02:25:06 +0000
parents a9dc0e7c3f2b
children 1d1d5d9bd884
comparison
equal deleted inserted replaced
101933:f9435803466a 101934:9bfebe85710d
141 (let ((suffixes nil)) 141 (let ((suffixes nil))
142 (dolist (suffix (get-load-suffixes) (nreverse suffixes)) 142 (dolist (suffix (get-load-suffixes) (nreverse suffixes))
143 (unless (string-match "elc" suffix) (push suffix suffixes))))) 143 (unless (string-match "elc" suffix) (push suffix suffixes)))))
144 144
145 (defun find-library-name (library) 145 (defun find-library-name (library)
146 "Return the absolute file name of the Lisp source of LIBRARY." 146 "Return the absolute file name of the Emacs Lisp source of LIBRARY.
147 LIBRARY should be a string (the name of the library)."
147 ;; If the library is byte-compiled, try to find a source library by 148 ;; If the library is byte-compiled, try to find a source library by
148 ;; the same name. 149 ;; the same name.
149 (if (string-match "\\.el\\(c\\(\\..*\\)?\\)\\'" library) 150 (if (string-match "\\.el\\(c\\(\\..*\\)?\\)\\'" library)
150 (setq library (replace-match "" t t library))) 151 (setq library (replace-match "" t t library)))
151 (or 152 (or
205 (error "Can't find source for %s" fun-or-var)) 206 (error "Can't find source for %s" fun-or-var))
206 (cons (current-buffer) (match-beginning 0)))) 207 (cons (current-buffer) (match-beginning 0))))
207 208
208 ;;;###autoload 209 ;;;###autoload
209 (defun find-library (library) 210 (defun find-library (library)
210 "Find the elisp source of LIBRARY." 211 "Find the Emacs Lisp source of LIBRARY.
212 LIBRARY should be a string (the name of the library)."
211 (interactive 213 (interactive
212 (let* ((dirs (or find-function-source-path load-path)) 214 (let* ((dirs (or find-function-source-path load-path))
213 (suffixes (find-library-suffixes)) 215 (suffixes (find-library-suffixes))
214 (def (if (eq (function-called-at-point) 'require) 216 (def (if (eq (function-called-at-point) 'require)
215 ;; `function-called-at-point' may return 'require 217 ;; `function-called-at-point' may return 'require