]> git.donarmstrong.com Git - lib.git/blob - emacs_el/tiny-tools/tiny/load-path.el
add tiny-tools
[lib.git] / emacs_el / tiny-tools / tiny / load-path.el
1 ;;; load-path.el --- Used for compiling Emacs lisp files
2
3 ;;; Commentary:
4
5 ;;
6 ;;  File id
7 ;;
8 ;;      Copyright (C) 1997-2007 Jari Aalto
9 ;;
10 ;;      This program is free software; you can redistribute it and/or
11 ;;      modify it under the terms of the GNU General Public License as
12 ;;      published by the Free Software Foundation; either version 2 of
13 ;;      the License, or (at your option) any later version.
14 ;;
15 ;;      This program is distributed in the hope that it will be
16 ;;      useful, but WITHOUT ANY WARRANTY; without even the implied
17 ;;      warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 ;;      PURPOSE. See the GNU General Public License for more details.
19 ;;
20 ;;      You should have received a copy of the GNU General Public
21 ;;      License along with program; see the file COPYING. If not,
22 ;;      write to the Free Software Foundation, Inc., 51 Franklin
23 ;;      Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ;;
25 ;;      Visit <http://www.gnu.org/copyleft/gpl.html> for more information
26 ;;
27 ;;  Description
28 ;;
29 ;;      This file part of the Tiny Tools Kit for Emacs: collection of
30 ;;      various utilities.
31 ;;
32 ;;      Before compiling, this file is included via -l FILE switch and it
33 ;;      defines correct load path in order to find the files that are needed
34 ;;      in compilation. If your private directory is not in ~/elisp or
35 ;;      ~/lisp then add new path to the place shown below.
36
37 ;;; Code:
38
39 (require 'cl)
40 (setq debug-on-error nil) ;; Must be like this in batch byte compile
41
42 (autoload 'ti::package-autoload-create-on-file            "tinylib")
43 (autoload 'ti::package-autoload-loaddefs-build-recursive  "tinylib")
44
45 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46 ;;
47 ;;
48 ;;      PLEASE CONFIFURE THIS `dolist' to include paths in your system
49 ;;
50 ;;
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
52
53 (dolist (path
54          '(
55
56            ;; Define any new path HERE. It won't matter if you
57            ;; define non-exiting paths, they are stripped away.
58            ;;
59            ;;  some users prefer the directory called ~/lisp istead of
60            ;;  ~/elisp (Emacs Lisp)
61
62            "~/elisp"
63            "~/lisp"
64
65            ;;  Unix: Posisbly the best is to have
66            ;;  this directory to be a symbolic link to latest distribution
67            ;;
68            ;;  Win32: Symbolic links don't work, change this to the absolute
69            ;;  path of the kit location directories.
70
71            "~/elisp/tiny"
72            "~/elisp/tiny/lisp"
73            "~/elisp/tiny/lisp/tiny"
74            "~/elisp/tiny/lisp/other"
75
76            ;;  Any other directories that you have in you ~/elips or
77
78            "/usr/share/site-lisp"
79            "/usr/share/site-lisp/net"
80
81            ;; The best way to keep up with the development is to
82            ;; use CVS. See BBDB and Gnus sites for CVS.
83
84            "/usr/share/site-lisp/net/cvs-packages"
85            "/usr/share/site-lisp/net/cvs-packages/bbdb/lisp"
86            "/usr/share/site-lisp/net/cvs-packages/gnus/lisp"
87
88            ;;  Any other directories that you have in you ~/elips or
89            ;;  site wide /usr/share/site-lisp or under /opt hierarchy
90
91            "~/elisp/other"
92            "~/elisp/bbdb/lisp"        ;usually symbolic link to latest
93            "~/elisp/rc"
94            "."
95            ".."
96            "../other"
97            "../.."))
98   (when (file-exists-p path)
99     (pushnew (expand-file-name path) load-path :test 'string=)))
100
101 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102 ;;
103 ;;
104 ;;      LOAD PATH self-check
105 ;;
106 ;;
107 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
108
109 ;;; ----------------------------------------------------------------------
110 ;;;
111 (defun tiny-tmp-load-path-print (&optional function eval)
112   "Print `load-path' using `function'.
113 Default is `message'. Eval optional EVAL."
114   (let ((i 0))
115     (if eval
116         (eval eval))
117     (dolist (path load-path)
118       (if function
119           (funcall function "  %d %s" i path)
120         (message "  %d %s" i path))
121       (incf i))))
122
123 (eval-and-compile
124   ;;  Remove comment if you want to  see the load path
125   ;;  before compiling starts. The printed path (order) may give a clue
126   ;;  why compile might have failed.
127
128   ;; (tiny-tmp-load-path-print)
129
130   ;;  Check that load-path is in order
131   (let ((path (locate-library "tinylibm")))
132     (if path
133         nil ;; (message "FOUND: %s" path)
134       (tiny-tmp-load-path-print)
135       (message
136        "\
137   **  Can't find library [tinylibm]. Please update
138       file [load-path.el] which sets up load-path for compilation purposes."))))
139
140 ;;; load-path.el ends here