annotate lisp/packages.el @ 793:e38acbeb1cae

[xemacs-hg @ 2002-03-29 04:46:17 by ben] lots o' fixes etc/ChangeLog: New file. Separated out all entries for etc/ into their own ChangeLog. Includes entries for the following files: etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad, etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL, etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS, etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL, etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se, etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh, etc/custom/example-themes/europe-theme.el, etc/custom/example-themes/ex-custom-file, etc/custom/example-themes/example-theme.el, etc/e/eterm.ti, etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1, etc/gnuserv.README, etc/package-index.LATEST.gpg, etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm, etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs, etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E, etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm, etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm, etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar, etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1, etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL, etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el, etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\* unicode/unicode-consortium/8859-16.TXT: New file. mule/english.el: Define this charset now, since a bug was fixed that formerly prevented it. mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be integers. Makefile.in.in: Always include gui.c, to fix compile error when TTY-only. EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo(). Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate nearly all uses of Lisp_String * in favor of Lisp_Object, and correct macros so most of them favor Lisp_Object. Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings, but at level `debug' (usually ignored). Use it when instantiating specifiers, so problems can be debugged. Move log-warning-minimum-level into C so that we can optimize ERROR_ME_DEBUG_WARN. Fix warning levels consistent with new definitions. Add default_ and parent fields to char table; not yet implemented. New fun Dynarr_verify(); use for further error checking on Dynarrs. Rearrange code at top of lisp.h in conjunction with dynarr changes. Fix eifree(). Use Eistrings in various places (format_event_object(), where_is_to_char(), and callers thereof) to avoid fixed-size strings buffers. New fun write_eistring(). Reindent and fix GPM code to follow standards. Set default MS Windows font to Lucida Console (same size as Courier New but less interline spacing, so more lines fit). Increase default frame size on Windows to 50 lines. (If that's too big for the workspace, the frame will be shrunk as necessary.) Fix problem with text files with no newlines (). (Change `convert-eol' coding system to use `nil' for autodetect, consistent with make-coding-system.) Correct compile warnings in vm-limit.c. Fix handling of reverse-direction charsets to avoid errors when opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el. Recode some object printing methods to use write_fmt_string() instead of a fixed buffer and sprintf. Turn on display of png comments as warnings (level `info'), now that they're unobtrusive. Revamped the sound documentation. Fixed bug in redisplay w.r.t. hscroll/truncation/continuation glyphs causing jumping up and down of the lines, since they're bigger than the line size. (It was seen most obviously when there's a horizontal scroll bar, e.g. do C-h a glyph or something like that.) The problem was that the glyph-contrib-p setting on glyphs was ignored even if it was set properly, which it wasn't until now.
author ben
date Fri, 29 Mar 2002 04:49:13 +0000
parents 6a0eecc6df0e
children ceedb6eeaba8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; packages.el --- Low level support for XEmacs packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 689
diff changeset
4 ;; Copyright (C) 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Author: Steven L Baur <steve@xemacs.org>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Maintainer: Steven L Baur <steve@xemacs.org>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Keywords: internal, lisp, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;;; Synched up with: Not in FSF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;; This file is dumped with XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 ;; This file provides low level facilities for XEmacs startup --
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 ;; particularly regarding the package setup. This code has to run in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 ;; what we call "bare temacs" -- i.e. XEmacs without the usual Lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 ;; environment. Pay special attention:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 ;; - not to use the `lambda' macro. Use #'(lambda ...) instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 ;; (this goes for any package loaded before `subr.el'.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;; - not to use macros, because they are not yet available (and this
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
42 ;; file must be loadable uncompiled.) Built in macros, such as
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
43 ;; `when' and `unless' are fine, of course.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ;; - not to use `defcustom'. If you must add user-customizable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 ;; variables here, use `defvar', and add the variable to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 ;; `cus-start.el'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 ;; Because of all this, make sure that the stuff you put here really
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ;; belongs here.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 ;; This file requires find-paths.el.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 ;;; Package versioning
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 (defvar packages-package-list nil
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 448
diff changeset
59 "Database of installed packages and version numbers")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 (defvar packages-hierarchy-depth 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 "Depth of package hierarchies.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 (defvar packages-load-path-depth 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 "Depth of load-path search in package hierarchies.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 (defvar packages-data-path-depth 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 "Depth of data-path search in package hierarchies.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 (defvar early-packages nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 "Packages early in the load path.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 (defvar early-package-load-path nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 "Load path for packages early in the load path.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 (defvar late-packages nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 "Packages late in the load path.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 (defvar late-package-load-path nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 "Load path for packages late in the load path.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 (defvar last-packages nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 "Packages last in the load path.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 (defvar last-package-load-path nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 "Load path for packages last in the load path.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 (defun packages-compute-package-locations (user-init-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 "Compute locations of the various package directories.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 This is a list each of whose elements describes one directory.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 A directory description is a three-element list.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 The first element is either an absolute path or a subdirectory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 in the XEmacs hierarchy.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 The second component is one of the symbols EARLY, LATE, LAST,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 depending on the load-path segment the hierarchy is supposed to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 show up in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 The third component is a thunk which, if it returns NIL, causes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 the directory to be ignored."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 (list
689
6a0eecc6df0e [xemacs-hg @ 2001-12-06 09:35:50 by michaels]
michaels
parents: 633
diff changeset
100 (list (paths-construct-path (list user-init-directory "site-packages"))
6a0eecc6df0e [xemacs-hg @ 2001-12-06 09:35:50 by michaels]
michaels
parents: 633
diff changeset
101 'early #'(lambda () t))
6a0eecc6df0e [xemacs-hg @ 2001-12-06 09:35:50 by michaels]
michaels
parents: 633
diff changeset
102 (list (paths-construct-path (list user-init-directory "infodock-packages"))
6a0eecc6df0e [xemacs-hg @ 2001-12-06 09:35:50 by michaels]
michaels
parents: 633
diff changeset
103 'early #'(lambda () (featurep 'infodock)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 (list (paths-construct-path (list user-init-directory "mule-packages"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 'early #'(lambda () (featurep 'mule)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 (list (paths-construct-path (list user-init-directory "xemacs-packages"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 'early #'(lambda () t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 (list "site-packages" 'late #'(lambda () t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 (list "infodock-packages" 'late #'(lambda () (featurep 'infodock)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 (list "mule-packages" 'late #'(lambda () (featurep 'mule)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 (list "xemacs-packages" 'late #'(lambda () t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 (defun package-get-key-1 (info key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 "Locate keyword `key' in list."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 (cond ((null info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 ((eq (car info) key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 (nth 1 info))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 (t (package-get-key-1 (cddr info) key))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 (defun package-get-key (name key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 "Get info `key' from package `name'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 (let ((info (assq name packages-package-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 (when info
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 (package-get-key-1 (cdr info) key))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 (defun package-provide (name &rest attributes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 (let ((info (if (and attributes (floatp (car attributes)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 (list :version (car attributes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 attributes)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 (setq packages-package-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 (cons (cons name info) (remassq name packages-package-list)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 (defun package-require (name version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 (let ((pkg (assq name packages-package-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 (cond ((null pkg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 (error "Package %s has not been loaded into this XEmacsen"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 ((< (package-get-key name :version) version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 (error "Need version %g of package %s, got version %g"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 version name (cdr pkg)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 (t t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 (defun package-delete-name (name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 (let (pkg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 ;; Delete ALL versions of package.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 ;; This is pretty memory-intensive, as we use copy-alist when deleting
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 ;; package entries, to prevent side-effects in functions that call this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 ;; one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 (while (setq pkg (assq name packages-package-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 (setq packages-package-list (delete pkg (copy-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 packages-package-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 ;;; Build time stuff
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 (defvar autoload-file-name "auto-autoloads.el"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 "Filename that autoloads are expected to be found in.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 (defvar packages-hardcoded-lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 '(
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 ;; Nothing at this time
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 "Lisp packages that are always dumped with XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 This includes every package that is loaded directly by a package listed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 in dumped-lisp.el and is not itself listed.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 (defvar packages-useful-lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 '("bytecomp"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 "byte-optimize"
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 454
diff changeset
172 "autoload"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 "shadow"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 "cl-macs")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 "Lisp packages that need early byte compilation.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 (defvar packages-unbytecompiled-lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 '("paths.el"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 "dumped-lisp.el"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 "dumped-pkg-lisp.el"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 "version.el"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 "very-early-lisp.el")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 "Lisp packages that should not be byte compiled.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 ;; Copied from help.el, could possibly move it to here permanently.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 ;; Unlike the FSF version, our `locate-library' uses the `locate-file'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 ;; primitive, which should make it lightning-fast.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 (defun locate-library (library &optional nosuffix path interactive-call)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 "Show the precise file name of Emacs library LIBRARY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 This command searches the directories in `load-path' like `M-x load-library'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 to find the file that `M-x load-library RET LIBRARY RET' would load.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 to the specified name LIBRARY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 If the optional third arg PATH is specified, that list of directories
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 is used instead of `load-path'."
624
59c2a61efa7d [xemacs-hg @ 2001-06-30 23:07:06 by youngs]
youngs
parents: 601
diff changeset
199 (interactive (list (read-library-name "Locate library: ")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 nil nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 (let ((result
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 (locate-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 library
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 (or path load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 (cond ((or (rassq 'jka-compr-handler file-name-handler-alist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 (and (boundp 'find-file-hooks)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 (member 'crypt-find-file-hook find-file-hooks)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 ;; Compression involved.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 (if nosuffix
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 444
diff changeset
211 '("" ".gz" ".Z" ".bz2")
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 444
diff changeset
212 '(".elc" ".elc.gz" "elc.Z" ".elc.bz2"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 444
diff changeset
213 ".el" ".el.gz" ".el.Z" ".el.bz2"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 444
diff changeset
214 "" ".gz" ".Z" ".bz2")))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 ;; No compression.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 (if nosuffix
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 ""
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 '(".elc" ".el" "")))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 (and interactive-call
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 (if result
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 (message "Library is file %s" result)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 (message "No library %s in search path" library)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 result))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 (defun packages-add-suffix (str)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 (if (null (string-match "\\.el\\'" str))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 (concat str ".elc")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 str))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 (defun packages-list-autoloads-path ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 "List autoloads from precomputed load-path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 (let ((path load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 autoloads)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 (while path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 (if (file-exists-p (concat (car path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 autoload-file-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 (setq autoloads (cons (concat (car path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 autoload-file-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 autoloads)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 (setq path (cdr path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 autoloads))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 (defun packages-list-autoloads (source-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 "List autoload files in (what will be) the normal lisp search path.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 This function is used during build to find where the global symbol files so
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 they can be perused for their useful information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 (let ((files (directory-files (file-name-as-directory source-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 t ".*"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 file autolist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 ;; (print (prin1-to-string source-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 ;; (print (prin1-to-string files))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 (while (setq file (car-safe files))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 (if (and (file-directory-p file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 (file-exists-p (concat (file-name-as-directory file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 autoload-file-name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 (setq autolist (cons (concat (file-name-as-directory file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 autoload-file-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 autolist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 (setq files (cdr files)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 autolist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 ;; The following function cannot be called from a bare temacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 (defun packages-new-autoloads ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 "Return autoloads files that have been added or modified since XEmacs dump."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 (require 'loadhist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 (let ((me (concat invocation-directory invocation-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 (path load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 result dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 (while path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 (setq dir (file-truename (car path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 (let ((autoload-file (file-name-sans-extension (concat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 dir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 autoload-file-name))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 ;; Check for:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 ;; 1. An auto-autoload file that hasn't provided a feature (because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 ;; it has been installed since XEmacs was dumped).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 ;; 2. auto-autoload.el being newer than the executable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 ;; 3. auto-autoload.elc being newer than the executable (the .el
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 ;; could be missing or compressed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 (when (or (and (null (file-provides autoload-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 (or (file-exists-p (concat autoload-file ".elc"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 (file-exists-p (concat autoload-file ".el"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 (and (file-newer-than-file-p (concat autoload-file ".el") me)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 (setq autoload-file (concat autoload-file ".el")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 (and (file-newer-than-file-p (concat autoload-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 ".elc")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 me)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 (setq autoload-file (concat autoload-file ".elc"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 (push autoload-file result)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 (setq path (cdr path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 result))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 ;; The following function cannot be called from a bare temacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 (defun packages-reload-autoloads ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 "Reload new or updated auto-autoloads files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 This is an extremely dangerous function to call after the user-init-files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 is run. Don't call it or you'll be sorry."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 (let ((autoload-list (packages-new-autoloads)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 (while autoload-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 (let* ((autoload-file (car autoload-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 (feature (car-safe (file-provides autoload-file))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 (when feature
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 ;; (message "(unload-feature %S)" feature)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 (unload-feature feature))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 (condition-case nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 (load autoload-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 (t nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 (setq autoload-list (cdr autoload-list)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 ;; Data-directory is really a list now. Provide something to search it for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 ;; directories.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 (defun locate-data-directory-list (name &optional dir-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 "Locate the matching list of directories in a search path DIR-LIST.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 If no DIR-LIST is supplied, it defaults to `data-directory-list'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 (unless dir-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 (setq dir-list data-directory-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 (let (found found-dir found-dir-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 (while dir-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 (setq found (file-name-as-directory (concat (car dir-list) name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 found-dir (file-directory-p found))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 (and found-dir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 (setq found-dir-list (cons found found-dir-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 (setq dir-list (cdr dir-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 (nreverse found-dir-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 ;; Data-directory is really a list now. Provide something to search it for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 ;; a directory.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 (defun locate-data-directory (name &optional dir-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 "Locate a directory in a search path DIR-LIST (a list of directories).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 If no DIR-LIST is supplied, it defaults to `data-directory-list'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 (unless dir-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 (setq dir-list data-directory-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 (let (found found-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 (while (and (null found-dir) dir-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 (setq found (file-name-as-directory (concat (car dir-list) name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 found-dir (file-directory-p found))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 (or found-dir
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 (setq found nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 (setq dir-list (cdr dir-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 found))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 ;; Data-directory is really a list now. Provide something to search it for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 ;; files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 (defun locate-data-file (name &optional dir-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 "Locate a file in a search path DIR-LIST (a list of directories).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 If no DIR-LIST is supplied, it defaults to `data-directory-list'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 This function is basically a wrapper over `locate-file'."
633
4bf478127536 [xemacs-hg @ 2001-07-20 02:41:28 by youngs]
youngs
parents: 624
diff changeset
352 (locate-file name (or dir-list data-directory-list)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 ;; Path setup
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 (defun packages-find-package-directories (roots base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 "Find a set of package directories."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 ;; make sure paths-find-version-directory and paths-find-site-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 ;; don't both pick up version-independent directories ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 (let ((version-directory (paths-find-version-directory roots base nil nil t))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
361 (site-directory (paths-find-site-directory roots base nil nil t)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 (paths-uniq-append
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 (and version-directory (list version-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 (and site-directory (list site-directory)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
366 (defvar packages-special-base-regexp "^\\(etc\\|info\\|man\\|lisp\\|lib-src\\|bin\\|pkginfo\\)$"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 "Special subdirectories of packages.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 (defvar packages-no-package-hierarchy-regexp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 (concat "\\(" paths-version-control-filename-regexp "\\)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 "\\|"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 "\\(" packages-special-base-regexp "\\)")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 "Directories which can't be the roots of package hierarchies.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 (defun packages-find-packages-in-directories (directories)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 "Find all packages underneath directories in DIRECTORIES."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 (paths-find-recursive-path directories
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 packages-hierarchy-depth
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 packages-no-package-hierarchy-regexp))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 (defun packages-split-path (path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 "Split PATH at \"\", return pair with two components.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 The second component is shared with PATH."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 (let ((reverse-tail '())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 (rest path))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 (while (and rest (null (string-equal "" (car rest))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 (setq reverse-tail (cons (car rest) reverse-tail))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 (setq rest (cdr rest)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 (if (null rest)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 (cons path nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 (cons (nreverse reverse-tail) (cdr rest)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 (defun packages-split-package-path (package-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 "Split up PACKAGE-PATH into early, late and last components.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 The separation is by \"\" components.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 This returns (LIST EARLY-PACKAGES LATE-PACKAGES LAST-PACKAGES)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 ;; When in doubt, it's late
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 (let* ((stuff (packages-split-path package-path))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 (early (and (cdr stuff) (car stuff)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 (late+last (or (cdr stuff) (car stuff)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 (stuff (packages-split-path late+last))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 (late (car stuff))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 (last (cdr stuff)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 (list (packages-find-packages-in-directories early)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 (packages-find-packages-in-directories late)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 (packages-find-packages-in-directories last))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 (defun packages-deconstruct (list consumer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 "Deconstruct LIST and feed it to CONSUMER."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 (apply consumer list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 (defun packages-find-packages-by-name (roots name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 "Find a package hierarchy by its name."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 (packages-find-packages-in-directories
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 (if (and (file-name-absolute-p name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 (file-name-directory (expand-file-name name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 (list (file-name-as-directory (expand-file-name name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 (packages-find-package-directories roots name))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (defun packages-find-packages-at-time
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 (roots package-locations time &optional default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 "Find packages at given time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 For the format of PACKAGE-LOCATIONS, see the global variable of the same name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 TIME is either 'EARLY, 'LATE, or 'LAST.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 DEFAULT is a default list of packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 (or default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 (let ((packages '()))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 (while package-locations
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
429 (packages-deconstruct
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 (car package-locations)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 #'(lambda (name a-time thunk)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 (if (and (eq time a-time)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 (funcall thunk))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 (setq packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 (nconc packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (packages-find-packages-by-name roots name))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 (setq package-locations (cdr package-locations)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 packages)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 (defun packages-find-packages (roots package-locations)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 "Find the packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 (let ((envvar-value (getenv "EMACSPACKAGEPATH")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 (if envvar-value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 (packages-split-package-path (paths-decode-directory-path envvar-value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 (packages-deconstruct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (packages-split-package-path configure-package-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 #'(lambda (configure-early-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 configure-late-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 configure-last-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 (list (packages-find-packages-at-time roots package-locations 'early
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 configure-early-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 (packages-find-packages-at-time roots package-locations 'late
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 configure-late-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 (packages-find-packages-at-time roots package-locations 'last
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 configure-last-packages)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 (defun packages-find-package-library-path (packages suffixes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 "Construct a path into a component of the packages hierarchy.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 PACKAGES is a list of package directories.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 SUFFIXES is a list of names of package subdirectories to look for."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 (let ((directories
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 (apply
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 #'nconc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 (mapcar #'(lambda (package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 (mapcar #'(lambda (suffix)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 (file-name-as-directory (concat package suffix)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 suffixes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 packages))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 (paths-directories-which-exist directories)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 (defun packages-find-package-load-path (packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 "Construct the load-path component for packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 PACKAGES is a list of package directories."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 (paths-find-recursive-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 (packages-find-package-library-path packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 '("lisp"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 packages-load-path-depth))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 (defun packages-find-package-exec-path (packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 "Construct the exec-path component for packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 PACKAGES is a list of package directories."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 (packages-find-package-library-path packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 (list (paths-construct-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 (list "bin" system-configuration))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 "lib-src")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 (defun packages-find-package-info-path (packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 "Construct the info-path component for packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 PACKAGES is a list of package directories."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 (packages-find-package-library-path packages '("info")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 (defun packages-find-package-data-path (packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 "Construct the data-path component for packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 PACKAGES is a list of package directories."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (paths-find-recursive-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 (packages-find-package-library-path packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 '("etc"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 packages-data-path-depth))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 ;; Loading package initialization files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 (defun packages-load-package-lisps (package-load-path base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 "Load all Lisp files of a certain name along a load path.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 BASE is the base name of the files."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 (mapcar #'(lambda (dir)
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 689
diff changeset
506 (let ((file-name (expand-file-name base dir)))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 689
diff changeset
507 (with-trapping-errors
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 689
diff changeset
508 :operation (format "Autoload %s" file-name)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 689
diff changeset
509 :class 'packages
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 689
diff changeset
510 (load file-name t t))))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 689
diff changeset
511 package-load-path))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 (defun packages-load-package-auto-autoloads (package-load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 "Load auto-autoload files along a load path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 (packages-load-package-lisps package-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 (file-name-sans-extension autoload-file-name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 (defun packages-handle-package-dumped-lisps (handle package-load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 "Load dumped-lisp.el files along a load path.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 Call HANDLE on each file off definitions of PACKAGE-LISP there."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 (mapcar #'(lambda (dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 (let ((file-name (expand-file-name "dumped-lisp.el" dir)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 (if (file-exists-p file-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 (let (package-lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 ;; 20.4 packages could set this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 preloaded-file-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 (load file-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 ;; dumped-lisp.el could have set this ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 (if package-lisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 (mapcar #'(lambda (base)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 (funcall handle base))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 package-lisp))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 package-load-path))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 (defun packages-load-package-dumped-lisps (package-load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 "Load dumped-lisp.el files along a load path.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
537 Also load files off PACKAGE-LISP definitions there."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 (packages-handle-package-dumped-lisps #'load package-load-path))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 (defun packages-collect-package-dumped-lisps (package-load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 "Load dumped-lisp.el files along a load path.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
542 Return list of files off PACKAGE-LISP definitions there."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 (let ((*files* '()))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 (packages-handle-package-dumped-lisps
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 #'(lambda (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 (setq *files* (cons file *files*)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 package-load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 (reverse *files*)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 (provide 'packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 ;;; packages.el ends here