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