1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Keywords: news, path
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
30 (defalias 'facep 'ignore)
34 (defvar srcdir (or (getenv "srcdir") "."))
36 (defun my-getenv (str)
37 (let ((val (getenv "lispdir")))
38 (if (equal val "no") nil val)))
40 (if (my-getenv "lispdir")
41 (push (my-getenv "lispdir") load-path))
43 (push (or (my-getenv "URLDIR") (expand-file-name "../../url/lisp/" srcdir))
46 (push (or (my-getenv "W3DIR") (expand-file-name "../../w3/lisp/" srcdir))
49 (push "/usr/share/emacs/site-lisp" load-path)
51 (unless (featurep 'xemacs)
52 (define-compiler-macro last (&whole form x &optional n)
53 (if (and (fboundp 'last)
54 (subrp (symbol-function 'last)))
70 (while (consp (cdr x))
75 ;; If we are building w3 in a different directory than the source
76 ;; directory, we must read *.el from source directory and write *.elc
77 ;; into the building directory. For that, we define this function
78 ;; before loading bytecomp. Bytecomp doesn't overwrite this function.
79 (defun byte-compile-dest-file (filename)
80 "Convert an Emacs Lisp source file name to a compiled file name.
81 In addition, remove directory name part from FILENAME."
82 (setq filename (byte-compiler-base-file-name filename))
83 (setq filename (file-name-sans-versions filename))
84 (setq filename (file-name-nondirectory filename))
85 (if (memq system-type '(win32 w32 mswindows windows-nt))
86 (setq filename (downcase filename)))
87 (cond ((eq system-type 'vax-vms)
88 (concat (substring filename 0 (string-match ";" filename)) "c"))
89 ((string-match emacs-lisp-file-regexp filename)
90 (concat (substring filename 0 (match-beginning 0)) ".elc"))
91 (t (concat filename ".elc"))))
95 (push srcdir load-path)
96 (load (expand-file-name "lpath.el" srcdir) nil t)
98 (defalias 'device-sound-enabled-p 'ignore)
99 (defalias 'play-sound-file 'ignore)
100 (defalias 'nndb-request-article 'ignore)
101 (defalias 'efs-re-read-dir 'ignore)
102 (defalias 'ange-ftp-re-read-dir 'ignore)
103 (defalias 'define-mail-user-agent 'ignore)
106 (unless (featurep 'xemacs)
107 (defalias 'get-popup-menu-response 'ignore)
108 (defalias 'event-object 'ignore)
109 (defalias 'x-defined-colors 'ignore)
110 (defalias 'read-color 'ignore)))
112 (defun dgnushack-compile (&optional warn)
113 ;;(setq byte-compile-dynamic t)
115 (setq byte-compile-warnings
116 '(free-vars unresolved callargs redefine)))
117 (unless (locate-library "cus-edit")
118 (error "You do not seem to have Custom installed.
119 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
120 You also then need to add the following to the lisp/dgnushack.el file:
122 (push \"~/lisp/custom\" load-path)
124 Modify to suit your needs."))
125 (let ((files (directory-files srcdir nil "^[^=].*\\.el$"))
126 ;;(byte-compile-generate-call-tree t)
128 ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
130 (when (featurep 'xemacs)
131 (setq gnus-xmas-glyph-directory "dummy"))
132 (dolist (file '("dgnushack.el" "lpath.el"))
133 (setq files (delete file files)))
134 (when (featurep 'base64)
135 (setq files (delete "base64.el" files)))
139 (message "No w3: %s %s" code (locate-library "w3-forms"))
140 (dolist (file '("nnweb.el" "nnlistserv.el" "nnultimate.el"
141 "nnslashdot.el" "nnwarchive.el" "webmail.el"
143 (setq files (delete file files)))))
145 (if (featurep 'xemacs)
146 '("md5.el" "smiley-ems.el")
147 '("gnus-xmas.el" "gnus-picon.el" "messagexmas.el"
148 "nnheaderxm.el" "smiley.el")))
149 (setq files (delete file files)))
152 (setq file (expand-file-name file srcdir))
153 (when (and (file-exists-p
154 (setq elc (concat (file-name-nondirectory file) "c")))
155 (file-newer-than-file-p file elc))
158 (while (setq file (pop files))
159 (setq file (expand-file-name file srcdir))
160 (when (or (not (file-exists-p
161 (setq elc (concat (file-name-nondirectory file) "c"))))
162 (file-newer-than-file-p file elc))
164 (byte-compile-file file))))))
166 (defun dgnushack-recompile ()
168 (byte-recompile-directory "." 0))
170 ;;; dgnushack.el ends here