1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994-2000 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news, path
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
33 (push "/usr/share/emacs/site-lisp" load-path)
35 (unless (featurep 'xemacs)
36 (define-compiler-macro last (&whole form x &optional n)
37 (if (and (fboundp 'last)
38 (subrp (symbol-function 'last)))
54 (while (consp (cdr x))
58 (define-compiler-macro mapcon (&whole form fn seq &rest rest)
59 (if (and (fboundp 'mapcon)
60 (subrp (symbol-function 'mapcon)))
64 (args (list ,seq ,@rest))
66 (while (not (memq nil args))
67 (push (apply ,fn args) res)
70 (setcar p (cdr (pop p)))
72 (apply (function nconc) (nreverse res)))
76 (push (funcall ,fn arg) res)
78 (apply (function nconc) (nreverse res))))))
80 (define-compiler-macro member-if (&whole form pred list)
81 (if (and (fboundp 'member-if)
82 (subrp (symbol-function 'member-if)))
87 (not (funcall fn (car seq))))
91 (define-compiler-macro union (&whole form list1 list2)
92 (if (and (fboundp 'union)
93 (subrp (symbol-function 'union)))
101 (or (>= (length a) (length b))
102 (setq a (prog1 b (setq b a))))
110 ;; If we are building w3 in a different directory than the source
111 ;; directory, we must read *.el from source directory and write *.elc
112 ;; into the building directory. For that, we define this function
113 ;; before loading bytecomp. Bytecomp doesn't overwrite this function.
114 (defun byte-compile-dest-file (filename)
115 "Convert an Emacs Lisp source file name to a compiled file name.
116 In addition, remove directory name part from FILENAME."
117 (setq filename (byte-compiler-base-file-name filename))
118 (setq filename (file-name-sans-versions filename))
119 (setq filename (file-name-nondirectory filename))
120 (if (memq system-type '(win32 w32 mswindows windows-nt))
121 (setq filename (downcase filename)))
122 (cond ((eq system-type 'vax-vms)
123 (concat (substring filename 0 (string-match ";" filename)) "c"))
124 ((string-match emacs-lisp-file-regexp filename)
125 (concat (substring filename 0 (match-beginning 0)) ".elc"))
126 (t (concat filename ".elc"))))
130 (defvar srcdir (or (getenv "srcdir") "."))
132 (push srcdir load-path)
133 ;(push "/usr/share/emacs/site-lisp" load-path)
134 (load (expand-file-name "lpath.el" srcdir) nil t)
136 (defalias 'device-sound-enabled-p 'ignore)
137 (defalias 'play-sound-file 'ignore)
138 (defalias 'nndb-request-article 'ignore)
139 (defalias 'efs-re-read-dir 'ignore)
140 (defalias 'ange-ftp-re-read-dir 'ignore)
141 (defalias 'define-mail-user-agent 'ignore)
144 (unless (string-match "XEmacs" emacs-version)
145 (fset 'get-popup-menu-response 'ignore)
146 (fset 'event-object 'ignore)
147 (fset 'x-defined-colors 'ignore)
148 (fset 'read-color 'ignore)))
150 (defun dgnushack-compile (&optional warn)
151 ;;(setq byte-compile-dynamic t)
153 (setq byte-compile-warnings
154 '(free-vars unresolved callargs redefine)))
155 (unless (locate-library "cus-edit")
156 (error "You do not seem to have Custom installed.
157 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
158 You also then need to add the following to the lisp/dgnushack.el file:
160 (push \"~/lisp/custom\" load-path)
162 Modify to suit your needs."))
163 (let ((files (directory-files srcdir nil "^[^=].*\\.el$"))
164 (xemacs (string-match "XEmacs" emacs-version))
165 ;;(byte-compile-generate-call-tree t)
170 (dolist (file '("nnweb.el" "nnlistserv.el" "nnultimate.el"
171 "nnslashdot.el" "nnwarchive.el" "webmail.el"))
172 (setq files (delete file files)))))
173 (while (setq file (pop files))
174 (setq file (expand-file-name file srcdir))
175 (when (or (and (not xemacs)
176 (not (member (file-name-nondirectory file)
177 '("gnus-xmas.el" "gnus-picon.el"
178 "messagexmas.el" "nnheaderxm.el"
179 "smiley.el" "x-overlay.el"))))
181 (not (member file '("md5.el")))))
182 (when (or (not (file-exists-p (setq elc (concat file "c"))))
183 (file-newer-than-file-p file elc))
185 (byte-compile-file file)))))))
187 (defun dgnushack-recompile ()
189 (byte-recompile-directory "." 0))
191 ;;; dgnushack.el ends here