comparison lisp/utils/lib-complete.el @ 155:43dd3413c7c7 r20-3b4

Import from CVS: tag r20-3b4
author cvs
date Mon, 13 Aug 2007 09:39:39 +0200
parents 6608ceec7cf8
children 28f395d8dc7a
comparison
equal deleted inserted replaced
154:94141801dd7e 155:43dd3413c7c7
1 ;;; lib-complete.el --- Completion on the lisp search path 1 ;;; lib-complete.el --- Completion on the lisp search path
2 2
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
3 ;; Copyright (C) Mike Williams <mike-w@cs.aukuni.ac.nz> 1991 4 ;; Copyright (C) Mike Williams <mike-w@cs.aukuni.ac.nz> 1991
4 5
5 ;; Author: Mike Williams <mike-w@cs.aukuni.ac.nz> 6 ;; Author: Mike Williams <mike-w@cs.aukuni.ac.nz>
6 ;; Maintainer: 7 ;; Maintainer: XEmacs Development Team
7 ;; Keywords: lisp, extensions 8 ;; Keywords: lisp, extensions
8 ;; Created: Sat Apr 20 17:47:21 1991 9 ;; Created: Sat Apr 20 17:47:21 1991
9 10
10 ;; This file is part of XEmacs. 11 ;; This file is part of XEmacs.
11 12
33 ;; Author : Mike Williams <mike-w@cs.aukuni.ac.nz> 34 ;; Author : Mike Williams <mike-w@cs.aukuni.ac.nz>
34 ;; Created On : Sat Apr 20 17:47:21 1991 35 ;; Created On : Sat Apr 20 17:47:21 1991
35 ;; Last Modified By: Heiko M|nkel <muenkel@tnt.uni-hannover.de> 36 ;; Last Modified By: Heiko M|nkel <muenkel@tnt.uni-hannover.de>
36 ;; Additional XEmacs integration By: Chuck Thompson <cthomp@cs.uiuc.edu> 37 ;; Additional XEmacs integration By: Chuck Thompson <cthomp@cs.uiuc.edu>
37 ;; Last Modified On: Thu Jul 1 14:23:00 1994 38 ;; Last Modified On: Thu Jul 1 14:23:00 1994
38 ;; RCS Info : $Revision: 1.2 $ $Locker: $ 39 ;; RCS Info : $Revision: 1.3 $ $Locker: $
39 ;; ======================================================================== 40 ;; ========================================================================
40 ;; NOTE: XEmacs must be redumped if this file is changed. 41 ;; NOTE: XEmacs must be redumped if this file is changed.
41 ;; 42 ;;
42 ;; Copyright (C) Mike Williams <mike-w@cs.aukuni.ac.nz> 1991 43 ;; Copyright (C) Mike Williams <mike-w@cs.aukuni.ac.nz> 1991
43 ;; 44 ;;
54 ;;; ChangeLog: 55 ;;; ChangeLog:
55 56
56 ;; 4/26/97: sb Mule-ize. 57 ;; 4/26/97: sb Mule-ize.
57 58
58 ;;; Code: 59 ;;; Code:
59
60 ;;=== Usage ===============================================================
61 ;;
62 ;; (autoload (fmakunbound 'load-library) "lib-complete" nil t)
63 ;; (autoload 'library-all-completions "lib-complete")
64 ;; (autoload 'read-library "lib-complete")
65 ;; (autoload 'find-library "lib-complete"
66 ;; "Find and edit the source for the library named LIBRARY.
67 ;; The extension of the LIBRARY must be omitted.")
68
69 ;;=== Locate a file in a search path ======================================
70
71 ;(defun locate-file (FILE SEARCH-PATH &optional SUFFIX-LIST PRED)
72 ; "Search for FILE on SEARCH-PATH (list). If optional SUFFIX-LIST is
73 ;provided, allow file to be followed by one of the suffixes.
74 ;Optional second argument PRED restricts the number of files which
75 ;may match. The default is file-exists-p."
76 ; (if (not SUFFIX-LIST) (setq SUFFIX-LIST '("")))
77 ; (if (not PRED) (setq PRED 'file-exists-p))
78 ; (if (file-name-absolute-p FILE) (setq SEARCH-PATH '(nil)))
79 ; (if (equal FILE "") (error "Empty filename"))
80 ; (let ((filelist
81 ; (mapcar
82 ; (function (lambda (ext) (concat FILE ext)))
83 ; SUFFIX-LIST)))
84 ; ;; Search SEARCH-PATH for a readable file in filelist
85 ; (catch 'found
86 ; (while SEARCH-PATH
87 ; (let ((filelist filelist))
88 ; (while filelist
89 ; (let ((filepath (expand-file-name (car filelist)
90 ; (car SEARCH-PATH))))
91 ; (if (funcall PRED filepath)
92 ; (throw 'found filepath)))
93 ; (setq filelist (cdr filelist))))
94 ; (setq SEARCH-PATH (cdr SEARCH-PATH))))
95 ; ))
96 60
97 ;;=== Determine completions for filename in search path =================== 61 ;;=== Determine completions for filename in search path ===================
98 62
99 (defun library-all-completions (FILE SEARCH-PATH &optional FULL FAST) 63 (defun library-all-completions (FILE SEARCH-PATH &optional FULL FAST)
100 "Return all completions for FILE in any directory on SEARCH-PATH. 64 "Return all completions for FILE in any directory on SEARCH-PATH.