1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994,95,96,97,98,99 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; Katsumi Yamaoka <yamaoka@jpl.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.
35 (load "./lpath.el" nil t)
37 (defalias 'device-sound-enabled-p 'ignore)
38 (defalias 'play-sound-file 'ignore)
39 (defalias 'nndb-request-article 'ignore)
40 (defalias 'efs-re-read-dir 'ignore)
41 (defalias 'ange-ftp-re-read-dir 'ignore)
42 (defalias 'define-mail-user-agent 'ignore)
45 (unless (string-match "XEmacs" emacs-version)
46 (fset 'get-popup-menu-response 'ignore)
47 (fset 'event-object 'ignore)
48 (fset 'x-defined-colors 'ignore)
49 (fset 'read-color 'ignore)))
51 (defun dgnushack-compile (&optional warn)
52 ;;(setq byte-compile-dynamic t)
54 (setq byte-compile-warnings
55 '(free-vars unresolved callargs redefine)))
56 (unless (locate-library "cus-edit")
57 (error "You do not seem to have Custom installed.
58 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
59 You also then need to add the following to the lisp/dgnushack.el file:
61 (push \"~/lisp/custom\" load-path)
63 Modify to suit your needs."))
64 (let ((files (directory-files "." nil "^[^=].*\\.el$"))
65 (xemacs (string-match "XEmacs" emacs-version))
66 ;;(byte-compile-generate-call-tree t)
70 (error (setq files (delete "nnweb.el" (delete "nnlistserv.el" files)))))
73 (error (setq files (delete "gnus-bbdb.el" files))))
74 (while (setq file (pop files))
75 (when (or (and (not xemacs)
76 (not (member file '("gnus-xmas.el" "gnus-picon.el"
77 "messagexmas.el" "nnheaderxm.el"
78 "smiley.el" "x-overlay.el"))))
80 (not (member file '("md5.el")))))
81 (when (or (not (file-exists-p (setq elc (concat file "c"))))
82 (file-newer-than-file-p file elc))
84 (byte-compile-file file)))))))
86 (defun dgnushack-recompile ()
88 (byte-recompile-directory "." 0))
91 ;; Avoid byte-compile warnings.
92 (defvar gnus-revision-number)
93 (defvar gnus-version-number)
94 (defvar gnus-product-name)
95 (defvar configure-package-path)
98 (defconst dgnushack-info-file-regexp
99 (concat "^\\(gnus\\|message\\|emacs-mime\\|gnus-ja\\|message-ja\\)"
100 "\\.info\\(-[0-9]+\\)?$"))
102 (defconst dgnushack-texi-file-regexp
103 "^\\(gnus\\|message\\|emacs-mime\\|gnus-ja\\|message-ja\\)\\.texi$")
105 (defun dgnushack-make-package ()
107 (let* ((product-name (downcase gnus-product-name))
108 (lisp-dir (concat "lisp/" product-name "/"))
111 (message "Updating autoloads for directory %s..." default-directory)
112 (let ((generated-autoload-file "auto-autoloads.el")
114 (update-autoloads-from-directory default-directory))
115 (byte-compile-file "auto-autoloads.el")
118 (let ((standard-output (current-buffer)))
119 (Custom-make-dependencies "."))
120 (message (buffer-string)))
122 (byte-compile-file "custom-load.el")
124 (message "Generating MANIFEST.%s for the package..." product-name)
126 (insert "pkginfo/MANIFEST." product-name "\n"
130 (sort (directory-files "." nil "\\.elc?$")
132 (concat "\n" lisp-dir))
136 (sort (directory-files "../texi/"
137 nil dgnushack-info-file-regexp)
141 (write-file (concat "../MANIFEST." product-name)))))
143 (defun dgnushack-install-package ()
144 (let* ((package-dir (file-name-as-directory
145 (or (car command-line-args-left)
146 (if (boundp 'configure-package-path)
147 (car configure-package-path)
148 (car package-path)))))
149 (info-dir (expand-file-name "info/" package-dir))
150 (pkginfo-dir (expand-file-name "pkginfo/" package-dir))
151 product-name lisp-dir manifest files)
153 (setq product-name (downcase gnus-product-name)
154 lisp-dir (expand-file-name (concat "lisp/" product-name "/")
156 manifest (concat "MANIFEST." product-name))
158 (unless (file-directory-p lisp-dir)
159 (make-directory lisp-dir t))
160 (unless (file-directory-p info-dir)
161 (make-directory info-dir))
162 (unless (file-directory-p pkginfo-dir)
163 (make-directory pkginfo-dir))
165 (setq files (sort (directory-files "." nil "\\.elc?$") 'string-lessp))
168 (unless (member file files)
169 (setq file (expand-file-name file lisp-dir))
170 (message "Removing %s..." file)
174 (directory-files lisp-dir nil nil nil t))
177 (message "Copying %s to %s..." file lisp-dir)
178 (copy-file file (expand-file-name file lisp-dir) t t))
183 (message "Copying ../texi/%s to %s..." file info-dir)
184 (copy-file (expand-file-name file "../texi/")
185 (expand-file-name file info-dir)
187 (sort (directory-files "../texi/" nil dgnushack-info-file-regexp)
190 (message "Copying ../%s to %s..." manifest pkginfo-dir)
191 (copy-file (expand-file-name manifest "../")
192 (expand-file-name manifest pkginfo-dir) t t)
196 (defun dgnushack-add-info-suffix-maybe ()
197 ;; This function must be invoked from texi directory.
198 (let ((coding-system-for-read 'raw-text)
199 (coding-system-for-write 'raw-text)
200 (files (directory-files "." nil dgnushack-texi-file-regexp))
201 file make-backup-files)
202 (while (setq file (pop files))
204 (when (and (re-search-forward
205 "^@setfilename[\t ]+\\([^\t\n ]+\\)" nil t)
206 (not (string-match "\\.info$" (match-string 1))))
207 (copy-file file (concat file "_") nil t)
210 (kill-buffer (current-buffer)))))
212 ;;; dgnushack.el ends here