Mercurial > hg > xemacs-beta
comparison lisp/prim/packages.el @ 163:0132846995bd r20-3b8
Import from CVS: tag r20-3b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:43:35 +0200 |
parents | |
children | 929b76928fce |
comparison
equal
deleted
inserted
replaced
162:4de2936b4e77 | 163:0132846995bd |
---|---|
1 ;;; packages.el --- Low level support for XEmacs packages | |
2 | |
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Steven L Baur <steve@altair.xemacs.org> | |
6 ;; Keywords: internal, lisp | |
7 | |
8 ;; This file is part of XEmacs. | |
9 | |
10 ;; XEmacs is free software; you can redistribute it and/or modify it | |
11 ;; under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; XEmacs is distributed in the hope that it will be useful, but | |
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 ;; General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
23 ;; 02111-1307, USA. | |
24 | |
25 ;;; Synched up with: Not in FSF | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;; This file provides low level facilities for XEmacs startup. Special | |
30 ;; requirements apply to some of these functions because they can be called | |
31 ;; during build from temacs and much of the usual lisp environment may | |
32 ;; be missing. | |
33 | |
34 ;;; Code: | |
35 | |
36 (defvar autoload-file-name "auto-autoloads.el" | |
37 "Filename that autoloads are expected to be found in.") | |
38 | |
39 (defvar packages-hardcoded-lisp | |
40 '("cl-defs" | |
41 "startup" | |
42 ) | |
43 "Lisp packages that are always dumped with XEmacs") | |
44 | |
45 (defvar packages-useful-lisp | |
46 '("bytecomp" | |
47 "byte-optimize" | |
48 "advice") | |
49 "Lisp packages that need early byte compilation.") | |
50 | |
51 (defvar packages-unbytecompiled-lisp | |
52 '("paths.el" | |
53 "version.el") | |
54 "Lisp packages that should not be byte compiled.") | |
55 | |
56 ;; Copied from subr.el | |
57 (if (null (fboundp 'lambda)) | |
58 (defmacro lambda (&rest cdr) | |
59 (list 'function (cons 'lambda cdr)))) | |
60 | |
61 ;; Copied from help.el, could possibly move it to here permanently. | |
62 ;; This is taken directly from Emacs 19.34.94. | |
63 | |
64 (defun locate-library (library &optional nosuffix path interactive-call) | |
65 "Show the precise file name of Emacs library LIBRARY. | |
66 This command searches the directories in `load-path' like `M-x load-library' | |
67 to find the file that `M-x load-library RET LIBRARY RET' would load. | |
68 Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el' | |
69 to the specified name LIBRARY. | |
70 | |
71 If the optional third arg PATH is specified, that list of directories | |
72 is used instead of `load-path'." | |
73 (interactive (list (read-string "Locate library: ") | |
74 nil nil | |
75 t)) | |
76 (let (result) | |
77 (catch 'answer | |
78 (mapcar | |
79 (lambda (dir) | |
80 (mapcar | |
81 (lambda (suf) | |
82 (let ((try (expand-file-name (concat library suf) dir))) | |
83 (and (file-readable-p try) | |
84 (null (file-directory-p try)) | |
85 (progn | |
86 (setq result try) | |
87 (throw 'answer try))))) | |
88 (if nosuffix | |
89 '("") | |
90 (let ((basic '(".elc" ".el" "")) | |
91 (compressed '(".Z" ".gz" ""))) | |
92 ;; If autocompression mode is on, | |
93 ;; consider all combinations of library suffixes | |
94 ;; and compression suffixes. | |
95 (if (rassq 'jka-compr-handler file-name-handler-alist) | |
96 (apply 'nconc | |
97 (mapcar (lambda (compelt) | |
98 (mapcar (lambda (baselt) | |
99 (concat baselt compelt)) | |
100 basic)) | |
101 compressed)) | |
102 basic))))) | |
103 (or path load-path))) | |
104 (and interactive-call | |
105 (if result | |
106 (message "Library is file %s" result) | |
107 (message "No library %s in search path" library))) | |
108 result)) | |
109 | |
110 (defun packages-add-suffix (str) | |
111 (if (null (string-match "\\.el\\'" str)) | |
112 (concat str ".elc") | |
113 str)) | |
114 | |
115 (defun list-autoloads () | |
116 "List autoload files in (what will be) the normal lisp search path. | |
117 This function is used during build to find where the global symbol files so | |
118 they can be perused for their useful information." | |
119 ;; Source directory may not be initialized yet. | |
120 ;; (print (prin1-to-string load-path)) | |
121 (if (null source-directory) | |
122 (setq source-directory (concat (car load-path) "/.."))) | |
123 (let ((files (directory-files source-directory t ".*")) | |
124 file autolist) | |
125 (while (setq file (car-safe files)) | |
126 (if (and (file-directory-p file) | |
127 (file-exists-p (concat file "/" autoload-file-name))) | |
128 (setq autolist (cons (concat file "/" autoload-file-name) | |
129 autolist))) | |
130 (setq files (cdr files))) | |
131 autolist)) | |
132 | |
133 (provide 'packages) | |
134 | |
135 ;;; packages.el ends here |