1 ;; Add the current dir to the load-path
2 (setq load-path (cons default-directory load-path))
3 ;(setq debug-on-error t)
5 (defun vm-fix-cygwin-path (path)
6 "If PATH does not exist, try the DOS path instead.
7 This handles EmacsW32 path problems when building on cygwin."
8 (if (file-exists-p path)
10 (let ((dos-path (cond ((functionp 'mswindows-cygwin-to-win32-path)
11 (mswindows-cygwin-to-win32-path path))
12 ((and (locate-library "cygwin-mount")
13 (require 'cygwin-mount))
14 (cygwin-mount-activate)
15 (cygwin-mount-convert-file-name path))
16 ((string-match "^/cygdrive/\\([a-z]\\)" path)
17 (replace-match (format "%s:"
18 (match-string 1 path))
20 (if (and dos-path (file-exists-p dos-path))
24 ;; Add additional dirs to the load-path
25 (when (getenv "OTHERDIRS")
26 (let ((otherdirs (read (format "%s" (getenv "OTHERDIRS"))))
29 (setq dir (car otherdirs))
30 (if (not (file-exists-p dir))
31 (error "Extra `load-path' directory %S does not exist!" dir))
32 ; (print (format "Adding %S" dir))
33 (setq load-path (cons dir load-path)
34 otherdirs (cdr otherdirs)))))
38 (setq byte-compile-warnings '(free-vars))
39 (put 'inhibit-local-variables 'byte-obsolete-variable nil)
41 ;; Preload these to get macros right
49 (defun vm-custom-make-dependencies ()
50 (if (load-library "cus-dep")
51 (if (functionp 'Custom-make-dependencies)
52 (Custom-make-dependencies)
53 (let ((generated-custom-dependencies-file "vm-cus-load.el"))
54 (custom-make-dependencies)))
55 (error "Failed to load 'cus-dep'")))
57 (defun vm-built-autoloads (&optional autoloads-file source-dir)
58 (let ((autoloads-file (or autoloads-file
59 (vm-fix-cygwin-path (car command-line-args-left))))
60 (source-dir (or source-dir
61 (vm-fix-cygwin-path (car (cdr command-line-args-left)))))
63 (enable-local-eval nil))
64 (if (not (file-exists-p source-dir))
65 (error "Built directory %S does not exist!" source-dir))
66 (message "Building autoloads file %S\nin directory %S." autoloads-file source-dir)
67 (load-library "autoload")
68 (set-buffer (find-file-noselect autoloads-file))
70 (setq generated-autoload-file autoloads-file)
71 (setq autoload-package-name "vm")
72 (setq make-backup-files nil)
73 (if (featurep 'xemacs)
75 (update-autoloads-from-directory source-dir)
76 (fixup-autoload-buffer (concat (if autoload-package-name
78 (file-name-nondirectory defdir))
80 (save-some-buffers t))
81 ;; GNU Emacs 21 wants some content, but 22 does not like it ...
82 (insert ";;; vm-autoloads.el --- automatically extracted autoloads\n")
84 (insert ";;; Code:\n")
85 (if (>= emacs-major-version 21)
86 (update-autoloads-from-directories source-dir)
87 (if (>= emacs-major-version 22)
88 (update-directory-autoloads source-dir)
89 (error "Do not know how to generate autoloads"))))))