1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000
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 (push (or (getenv "lispdir")
37 "/usr/share/emacs/site-lisp")
40 (push (or (getenv "W3DIR") (expand-file-name "../../w3/lisp/" srcdir))
43 (push "/usr/share/emacs/site-lisp" load-path)
45 (unless (featurep 'xemacs)
46 (define-compiler-macro last (&whole form x &optional n)
47 (if (and (fboundp 'last)
48 (subrp (symbol-function 'last)))
64 (while (consp (cdr x))
69 ;; If we are building w3 in a different directory than the source
70 ;; directory, we must read *.el from source directory and write *.elc
71 ;; into the building directory. For that, we define this function
72 ;; before loading bytecomp. Bytecomp doesn't overwrite this function.
73 (defun byte-compile-dest-file (filename)
74 "Convert an Emacs Lisp source file name to a compiled file name.
75 In addition, remove directory name part from FILENAME."
76 (setq filename (byte-compiler-base-file-name filename))
77 (setq filename (file-name-sans-versions filename))
78 (setq filename (file-name-nondirectory filename))
79 (if (memq system-type '(win32 w32 mswindows windows-nt))
80 (setq filename (downcase filename)))
81 (cond ((eq system-type 'vax-vms)
82 (concat (substring filename 0 (string-match ";" filename)) "c"))
83 ((string-match emacs-lisp-file-regexp filename)
84 (concat (substring filename 0 (match-beginning 0)) ".elc"))
85 (t (concat filename ".elc"))))
89 (push srcdir load-path)
90 (load (expand-file-name "lpath.el" srcdir) nil t)
92 (defalias 'device-sound-enabled-p 'ignore)
93 (defalias 'play-sound-file 'ignore)
94 (defalias 'nndb-request-article 'ignore)
95 (defalias 'efs-re-read-dir 'ignore)
96 (defalias 'ange-ftp-re-read-dir 'ignore)
97 (defalias 'define-mail-user-agent 'ignore)
100 (unless (featurep 'xemacs)
101 (defalias 'get-popup-menu-response 'ignore)
102 (defalias 'event-object 'ignore)
103 (defalias 'x-defined-colors 'ignore)
104 (defalias 'read-color 'ignore)))
106 (defun dgnushack-compile (&optional warn)
107 ;;(setq byte-compile-dynamic t)
109 (setq byte-compile-warnings
110 '(free-vars unresolved callargs redefine)))
111 (unless (locate-library "cus-edit")
112 (error "You do not seem to have Custom installed.
113 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
114 You also then need to add the following to the lisp/dgnushack.el file:
116 (push \"~/lisp/custom\" load-path)
118 Modify to suit your needs."))
119 (let ((files (directory-files srcdir nil "^[^=].*\\.el$"))
120 ;;(byte-compile-generate-call-tree t)
122 ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
124 (when (featurep 'xemacs)
125 (setq gnus-xmas-glyph-directory "dummy"))
126 (dolist (file '("dgnushack.el" "lpath.el"))
127 (setq files (delete file files)))
128 (when (featurep 'base64)
129 (setq files (delete "base64.el" files)))
133 (message "No w3: %s %s" code (locate-library "w3-forms"))
134 (dolist (file '("nnweb.el" "nnlistserv.el" "nnultimate.el"
135 "nnslashdot.el" "nnwarchive.el" "webmail.el"
137 (setq files (delete file files)))))
139 (if (featurep 'xemacs)
140 '("md5.el" "smiley-ems.el")
141 '("gnus-xmas.el" "gnus-picon.el" "messagexmas.el"
142 "nnheaderxm.el" "smiley.el")))
143 (setq files (delete file files)))
146 (setq file (expand-file-name file srcdir))
147 (when (and (file-exists-p
148 (setq elc (concat (file-name-nondirectory file) "c")))
149 (file-newer-than-file-p file elc))
152 (while (setq file (pop files))
153 (setq file (expand-file-name file srcdir))
154 (when (or (not (file-exists-p
155 (setq elc (concat (file-name-nondirectory file) "c"))))
156 (file-newer-than-file-p file elc))
158 (byte-compile-file file))))))
160 (defun dgnushack-recompile ()
162 (byte-recompile-directory "." 0))
164 ;;; dgnushack.el ends here