aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-09-21 23:07:06 +0000
committerRichard M. Stallman1996-09-21 23:07:06 +0000
commita130d829db01d0b9f5761a84215a9912fda4b602 (patch)
tree566897a1bcc2e49ccc38743826462c5b641c3a4f
parent7ebea14458b0cde69ac904c4de95615a045d1ca7 (diff)
downloademacs-a130d829db01d0b9f5761a84215a9912fda4b602.tar.gz
emacs-a130d829db01d0b9f5761a84215a9912fda4b602.zip
(locate-library): Print no messages if called from Lisp.
-rw-r--r--lisp/help.el68
1 files changed, 37 insertions, 31 deletions
diff --git a/lisp/help.el b/lisp/help.el
index 97887b1c81c..bc9b6ce0293 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -666,7 +666,7 @@ Argument is a command definition, usually a symbol with a function definition."
666 (message "%s is not on any key" definition))) 666 (message "%s is not on any key" definition)))
667 nil) 667 nil)
668 668
669(defun locate-library (library &optional nosuffix path) 669(defun locate-library (library &optional nosuffix path interactive-call)
670 "Show the precise file name of Emacs library LIBRARY. 670 "Show the precise file name of Emacs library LIBRARY.
671This command searches the directories in `load-path' like `M-x load-library' 671This command searches the directories in `load-path' like `M-x load-library'
672to find the file that `M-x load-library RET LIBRARY RET' would load. 672to find the file that `M-x load-library RET LIBRARY RET' would load.
@@ -675,35 +675,41 @@ to the specified name LIBRARY.
675 675
676If the optional third arg PATH is specified, that list of directories 676If the optional third arg PATH is specified, that list of directories
677is used instead of `load-path'." 677is used instead of `load-path'."
678 (interactive "sLocate library: ") 678 (interactive (list (read-string "Locate library: ")
679 (catch 'answer 679 nil nil
680 (mapcar 680 t))
681 '(lambda (dir) 681 (let (result)
682 (mapcar 682 (catch 'answer
683 '(lambda (suf) 683 (mapcar
684 (let ((try (expand-file-name (concat library suf) dir))) 684 '(lambda (dir)
685 (and (file-readable-p try) 685 (mapcar
686 (null (file-directory-p try)) 686 '(lambda (suf)
687 (progn 687 (let ((try (expand-file-name (concat library suf) dir)))
688 (message "Library is file %s" try) 688 (and (file-readable-p try)
689 (throw 'answer try))))) 689 (null (file-directory-p try))
690 (if nosuffix 690 (progn
691 '("") 691 (setq result try)
692 (let ((basic '(".elc" ".el" "")) 692 (throw 'answer try)))))
693 (compressed '(".Z" ".gz" ""))) 693 (if nosuffix
694 ;; If autocompression mode is on, 694 '("")
695 ;; consider all combinations of library suffixes 695 (let ((basic '(".elc" ".el" ""))
696 ;; and compression suffixes. 696 (compressed '(".Z" ".gz" "")))
697 (if (rassq 'jka-compr-handler file-name-handler-alist) 697 ;; If autocompression mode is on,
698 (apply 'nconc 698 ;; consider all combinations of library suffixes
699 (mapcar '(lambda (compelt) 699 ;; and compression suffixes.
700 (mapcar '(lambda (baselt) 700 (if (rassq 'jka-compr-handler file-name-handler-alist)
701 (concat baselt compelt)) 701 (apply 'nconc
702 basic)) 702 (mapcar '(lambda (compelt)
703 compressed)) 703 (mapcar '(lambda (baselt)
704 basic))))) 704 (concat baselt compelt))
705 (or path load-path)) 705 basic))
706 (message "No library %s in search path" library) 706 compressed))
707 nil)) 707 basic)))))
708 (or path load-path)))
709 (and interactive-call
710 (if result
711 (message "Library is file %s" result)
712 (message "No library %s in search path" library)))
713 result))
708 714
709;;; help.el ends here 715;;; help.el ends here