Mercurial > hg > xemacs-beta
diff lisp/prim/packages.el @ 177:6075d714658b r20-3b15
Import from CVS: tag r20-3b15
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:51:16 +0200 |
parents | 929b76928fce |
children | 9ad43877534d |
line wrap: on
line diff
--- a/lisp/prim/packages.el Mon Aug 13 09:50:16 2007 +0200 +++ b/lisp/prim/packages.el Mon Aug 13 09:51:16 2007 +0200 @@ -54,9 +54,29 @@ "Lisp packages that should not be byte compiled.") ;; Copied from subr.el -(if (null (fboundp 'lambda)) - (defmacro lambda (&rest cdr) - (list 'function (cons 'lambda cdr)))) +(defmacro lambda (&rest cdr) + "Return a lambda expression. +A call of the form (lambda ARGS DOCSTRING INTERACTIVE BODY) is +self-quoting; the result of evaluating the lambda expression is the +expression itself. The lambda expression may then be treated as a +function, i.e., stored as the function value of a symbol, passed to +funcall or mapcar, etc. + +ARGS should take the same form as an argument list for a `defun'. +DOCSTRING is an optional documentation string. + If present, it should describe how to call the function. + But documentation strings are usually not useful in nameless functions. +INTERACTIVE should be a call to the function `interactive', which see. +It may also be omitted. +BODY should be a list of lisp expressions." + ;; Note that this definition should not use backquotes; subr.el should not + ;; depend on backquote.el. + ;; #### - I don't see why. So long as backquote.el doesn't use anything + ;; from subr.el, there's no problem with using backquotes here. --Stig + ;;(list 'function (cons 'lambda cdr))) + ;; -slb, This has to run in a naked temacs. Enough is enough. + ;; `(function (lambda ,@cdr))) + (list 'function (cons 'lambda cdr))) ;; Copied from help.el, could possibly move it to here permanently. ;; This is taken directly from Emacs 19.34.94. @@ -130,6 +150,68 @@ (setq files (cdr files))) autolist)) +;; The following function is called from temacs +(defun packages-find-packages-1 (package path-only) + "Search the supplied directory for associated directories. +The top level is assumed to look like: +info/ Contain texinfo files for lisp installed in this hierarchy +etc/ Contain data files for lisp installled in this hiearchy +lisp/ Contain directories which either have straight lisp code + or are self-contained packages of their own." + ;; Info files + (if (and (null path-only) (file-directory-p (concat package "/info"))) + (setq Info-default-directory-list + (cons (concat package "/info/") Info-default-directory-list))) + ;; Data files + (if (and (null path-only) (file-directory-p (concat package "/etc"))) + (setq data-directory-list + (cons (concat package "/etc/") data-directory-list))) + ;; Lisp files + (if (file-directory-p (concat package "/lisp")) + (progn + (setq load-path (cons (concat package "/lisp/") load-path)) + (let ((dirs (directory-files (concat package "/lisp/") + t "^[^-.]" nil 'dirs-only)) + dir) + (while dirs + (setq dir (car dirs)) + (setq load-path (cons dir load-path)) + (packages-find-packages-1 dir path-only) + (setq dirs (cdr dirs))))))) + +;; The following function is called from temacs +(defun packages-find-packages (pkg-path path-only) + "Search the supplied path for additional info/etc/lisp directories. +Lisp directories if configured prior to build time will have equivalent +status as bundled packages." + (let ((path pkg-path) + dir) + (while path + (setq dir (car path)) + (prin1 (concat "Find: " (expand-file-name dir) "\n")) + (packages-find-packages-1 (expand-file-name dir) path-only) + (setq path (cdr path))))) + +;; Data-directory is really a list now. Provide something to search it for +;; directories. + +(defun locate-data-directory (name &optional data-dir-list) + "Locate a directory in a search path." + (unless data-dir-list + (setq data-dir-list data-directory-list)) + (let (dir found found-dir (dirs data-dir-list)) + (while (and (null found-dir) dirs) + (setq dir (car dirs)) + (setq found (concat dir name "/")) + (setq found-dir (file-directory-p found)) + (setq dirs (cdr dirs))) + found)) + +;; If we are being loaded as part of being dumped, bootstrap the rest of the +;; load-path for loaddefs. +(if (fboundp 'load-gc) + (packages-find-packages package-path t)) + (provide 'packages) ;;; packages.el ends here