1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Katsumi Yamaoka <yamaoka@jpl.org>
8 ;; Keywords: news, path
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
31 ;; Set coding priority of Shift-JIS to the bottom.
32 (if (featurep 'xemacs)
33 (defalias 'set-coding-priority 'ignore)
34 (defalias 'coding-priority-list 'ignore)
35 (defalias 'set-coding-priority-list 'ignore))
36 (cond ((and (featurep 'xemacs) (featurep 'mule))
37 (if (memq 'shift-jis (coding-priority-list))
38 (set-coding-priority-list
39 (append (delq 'shift-jis (coding-priority-list)) '(shift-jis)))))
41 (put '*coding-category-sjis* 'priority (length *predefined-category*)))
43 (if (memq 'coding-category-sjis coding-category-list)
45 (append (delq 'coding-category-sjis
46 (copy-sequence coding-category-list))
47 '(coding-category-sjis))))))
49 (defalias 'facep 'ignore)
52 (unless (dolist (var nil t))
53 ;; Override the macro `dolist' which may have been defined in egg.el.
54 (load "cl-macs" nil t))
56 (defvar srcdir (or (getenv "srcdir") "."))
58 (defvar dgnushack-w3-directory (let ((w3dir (getenv "W3DIR")))
59 (unless (zerop (length w3dir))
60 (file-name-as-directory w3dir))))
62 (let ((urldir (getenv "URLDIR")))
63 (unless (zerop (length urldir))
64 (setq urldir (file-name-as-directory urldir))
65 (push (file-name-as-directory urldir) load-path))
66 (when (and dgnushack-w3-directory
67 (not (string-equal urldir dgnushack-w3-directory)))
68 (push dgnushack-w3-directory load-path)))
70 ;; If we are building w3 in a different directory than the source
71 ;; directory, we must read *.el from source directory and write *.elc
72 ;; into the building directory. For that, we define this function
73 ;; before loading bytecomp. Bytecomp doesn't overwrite this function.
74 (defun byte-compile-dest-file (filename)
75 "Convert an Emacs Lisp source file name to a compiled file name.
76 In addition, remove directory name part from FILENAME."
77 (setq filename (byte-compiler-base-file-name filename))
78 (setq filename (file-name-sans-versions filename))
79 (setq filename (file-name-nondirectory filename))
80 (if (memq system-type '(win32 w32 mswindows windows-nt))
81 (setq filename (downcase filename)))
82 (cond ((eq system-type 'vax-vms)
83 (concat (substring filename 0 (string-match ";" filename)) "c"))
84 ((string-match emacs-lisp-file-regexp filename)
85 (concat (substring filename 0 (match-beginning 0)) ".elc"))
86 (t (concat filename ".elc"))))
89 ;; To avoid having defsubsts and inlines happen.
90 ;(if (featurep 'xemacs)
91 ; (require 'byte-optimize)
92 ; (require 'byte-opt))
93 ;(defun byte-optimize-inline-handler (form)
94 ; "byte-optimize-handler for the `inline' special-form."
95 ; (cons 'progn (cdr form)))
96 ;(defalias 'byte-compile-file-form-defsubst 'byte-compile-file-form-defun)
99 (let (current-load-list)
100 ;; Make the function to be silent at compile-time.
101 (defun locate-library (library &optional nosuffix)
102 "Show the full path name of Emacs library LIBRARY.
103 This command searches the directories in `load-path' like `M-x load-library'
104 to find the file that `M-x load-library RET LIBRARY RET' would load.
105 Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
106 to the specified name LIBRARY (a la calling `load' instead of `load-library')."
107 (interactive "sLocate library: ")
113 (let ((try (expand-file-name (concat library suf) dir)))
114 (and (file-readable-p try)
115 (null (file-directory-p try))
118 (message "Library is file %s" try))
119 (throw 'answer try)))))
120 (if nosuffix '("") '(".elc" ".el" ""))))
123 (message "No library %s in search path" library))
125 (byte-compile 'locate-library)))
127 (unless (fboundp 'si:byte-optimize-form-code-walker)
128 (byte-optimize-form nil);; Load `byte-opt' or `byte-optimize'.
129 (setq max-specpdl-size 3000)
130 (defalias 'si:byte-optimize-form-code-walker
131 (symbol-function 'byte-optimize-form-code-walker))
132 (defun byte-optimize-form-code-walker (form for-effect)
133 (if (and for-effect (memq (car-safe form) '(and or)))
134 ;; Fix bug in and/or forms.
135 (let ((fn (car form))
136 (backwards (reverse (cdr form))))
137 (while (and backwards
138 (null (setcar backwards
139 (byte-optimize-form (car backwards) t))))
140 (setq backwards (cdr backwards)))
141 (if (and (cdr form) (null backwards))
143 " all subforms of %s called for effect; deleted" form))
145 (let ((head backwards))
146 (while (setq backwards (cdr backwards))
147 (setcar backwards (byte-optimize-form (car backwards)
149 (cons fn (nreverse head)))))
150 (si:byte-optimize-form-code-walker form for-effect)))
151 (byte-compile 'byte-optimize-form-code-walker))
155 (wrong-number-of-arguments
156 ;; Optimize byte code for `char-after'.
157 (put 'char-after 'byte-optimizer 'byte-optimize-char-after)
158 (defun byte-optimize-char-after (form)
159 (if (null (cdr form))
160 '(char-after (point))
165 (wrong-number-of-arguments
166 ;; Optimize byte code for `char-before'.
167 (put 'char-before 'byte-optimizer 'byte-optimize-char-before)
168 (defun byte-optimize-char-before (form)
169 (if (null (cdr form))
170 '(char-before (point))
173 (load (expand-file-name "dgnuspath.el" srcdir) nil nil t)
176 (load "~/.lpath.el" t nil t)
177 (error (message "Error in \"~/.lpath.el\" file: %s" err)))
179 ;; Don't load path-util until `char-after' and `char-before' have been
180 ;; optimized because it requires `poe' and then modify the functions.
182 ;; If the APEL modules are installed under the non-standard directory,
183 ;; for example "/var/home/john/lisp/apel-VERSION/", you should add that
184 ;; name using the configure option "--with-addpath=".
185 ;; And also the directory where the EMU modules are installed, for
186 ;; example "/usr/local/share/mule/19.34/site-lisp/", it should be
187 ;; included in the standard `load-path' or added by the configure
188 ;; option "--with-addpath=".
189 (let ((path (or (locate-library "path-util")
190 (locate-library "apel/path-util")));; backward compat.
194 (when (string-match "/$" (setq path (file-name-directory path)))
195 (setq path (substring path 0 (match-beginning 0))))
196 ;; path == "/var/home/john/lisp/apel-VERSION"
197 (when (string-match "/$" (setq parent (file-name-directory path)))
198 (setq parent (substring path 0 (match-beginning 0))))
199 ;; parent == "/var/home/john/lisp"
200 (if (setq lpath (or (member path load-path)
201 (member (file-name-as-directory path) load-path)))
202 (unless (or (member parent load-path)
203 (member (file-name-as-directory parent) load-path))
204 (push parent (cdr lpath)))
205 (push path load-path)
206 (unless (or (member parent load-path)
207 (member (file-name-as-directory parent) load-path))
208 (push parent (cdr load-path))))
209 (require 'path-util))
211 APEL modules are not found in %s.
212 Try to re-configure with --with-addpath=APEL_PATH and run make again.
216 (unless (locate-library "mel")
218 (unless (module-installed-p 'mel)
219 ;; FLIM 1.14 may have installed in two "flim" subdirectories.
220 (push (expand-file-name "flim"
221 (file-name-directory (get-latest-path "^apel$" t)))
223 (unless (module-installed-p 'mel)
225 FLIM modules does not found in %s.
226 Try to re-configure with --with-addpath=FLIM_PATH and run make again.
231 (push srcdir load-path)
232 (load (expand-file-name "lpath.el" srcdir) nil t t)
234 (load (expand-file-name "gnus-clfns.el" srcdir) nil t t)
237 ;; Bind the function `base64-encode-string' before loading canlock.
238 ;; Since canlock will bind it as an autoloaded function, it causes
239 ;; damage to define the function by MEL.
240 (load (expand-file-name "base64.el" srcdir) nil t t)
241 ;; Load special macros for compiling canlock.el.
242 (load (expand-file-name "canlock-om.el" srcdir) nil t t))
246 ;; Bind functions defined by `defun-maybe'.
247 (put 'defun-maybe 'byte-hunk-handler 'byte-compile-file-form-defun-maybe)
248 (defun byte-compile-file-form-defun-maybe (form)
249 (if (and (not (fboundp (nth 1 form)))
250 (memq 'unresolved byte-compile-warnings))
251 (setq byte-compile-function-environment
252 (cons (cons (nth 1 form)
253 (cons 'lambda (cdr (cdr form))))
254 byte-compile-function-environment)))
258 :symbol-for-testing-whether-colon-keyword-is-available-or-not
260 (defun dgnushack-bind-colon-keywords ()
261 "Bind all the colon keywords for old Emacsen."
262 (let ((cache (expand-file-name "dgnuskwds.el" srcdir))
263 (makefile (expand-file-name "Makefile" srcdir))
264 (buffer (get-buffer-create " *colon keywords*"))
265 keywords ignores files file dirs dir form elem make-backup-files)
268 (let (buffer-file-format
270 insert-file-contents-post-hook
271 insert-file-contents-pre-hook
272 jam-zcat-filename-list
273 jka-compr-compression-info-list)
274 (if (and (file-exists-p cache)
275 (file-exists-p makefile)
276 (file-newer-than-file-p cache makefile))
278 (insert-file-contents cache nil nil nil t)
279 (setq keywords (read buffer)))
282 '(:symbol-for-testing-whether-colon-keyword-is-available-or-not
283 ;; The following keywords will be bound by CUSTOM.
284 :get :group :initialize :link :load :options :prefix
285 :require :set :tag :type)
286 files (list (locate-library "semi-def")
287 (locate-library "mailcap")
288 (locate-library "mime-def")
289 (locate-library "path-util")
290 (locate-library "poem"))
291 dirs (list (file-name-as-directory (expand-file-name srcdir))))
293 (when (setq file (pop files))
294 (setq dir (file-name-directory file))
295 (unless (member dir dirs)
297 (message "Searching for all the colon keywords in:")
299 (setq dir (pop dirs))
300 (message " %s..." dir)
301 (setq files (directory-files dir t
302 "\\.el\\(\\.gz\\|\\.bz2\\)?$"))
304 (setq file (pop files))
305 (if (string-match "\\(\\.gz$\\)\\|\\.bz2$" file)
306 (let ((temp (expand-file-name "dgnustemp.el" srcdir)))
308 (let* ((binary (if (boundp 'MULE)
311 (coding-system-for-read binary)
312 (coding-system-for-write binary)
313 (input-coding-system binary)
314 (output-coding-system binary)
315 (default-process-coding-system
316 (cons binary binary))
318 (insert-file-contents file nil nil nil t)
322 (if (match-beginning 1)
324 (point-min) (point-max)
325 "gzip" t buffer nil "-cd")
327 (point-min) (point-max)
328 "bzip2" t buffer nil "-d"))
332 (message "In file %s: %s" file code)
334 (write-region (point-min) (point-max) temp
338 (insert-file-contents temp nil nil nil t)
339 (delete-file temp))))
340 (insert-file-contents file nil nil nil t))
341 (while (setq form (condition-case nil
346 (setq elem (pop form))
347 (unless (memq (car-safe elem)
348 '(defcustom defface defgroup
349 define-widget quote))
351 (push (car elem) form)
352 (setq elem (cdr elem)))
356 (eq ?: (aref (symbol-name elem) 0))
357 (not (memq elem ignores))
358 (not (memq elem keywords)))
359 (push elem keywords))))))))
360 (setq keywords (sort keywords
362 (string-lessp (symbol-name a)
365 (insert (format "%s" keywords))
366 (write-region (point-min) (point) cache nil 'silent)
368 "The following colon keywords will be bound at run-time:\n %s"
371 (defconst dgnushack-colon-keywords keywords)
373 (set (car keywords) (car keywords))
374 (setq keywords (cdr keywords)))))
375 (byte-compile 'dgnushack-bind-colon-keywords)
376 (dgnushack-bind-colon-keywords)))
379 (setq :version ':version
380 :set-after ':set-after)
382 (defadvice custom-handle-keyword
383 (around dont-signal-an-error-even-if-unsupported-keyword-is-given
385 "Don't signal an error even if unsupported keyword is given."
386 (if (not (memq (ad-get-arg 1) '(:version :set-after)))
390 (put 'custom-declare-face 'byte-optimizer
391 'byte-optimize-ignore-unsupported-custom-keywords)
392 (put 'custom-declare-group 'byte-optimizer
393 'byte-optimize-ignore-unsupported-custom-keywords)
394 (defun byte-optimize-ignore-unsupported-custom-keywords (form)
395 (if (or (memq ':version (nthcdr 4 form))
396 (memq ':set-after (nthcdr 4 form)))
397 (let ((newform (list (car form) (nth 1 form)
398 (nth 2 form) (nth 3 form)))
399 (args (nthcdr 4 form)))
401 (or (memq (car args) '(:version :set-after))
402 (setq newform (nconc newform (list (car args)
404 (setq args (cdr (cdr args))))
408 (put 'custom-declare-variable 'byte-hunk-handler
409 'byte-compile-file-form-custom-declare-variable)
410 (defun byte-compile-file-form-custom-declare-variable (form)
411 ;; Bind defcustom'ed variables.
412 (if (memq 'free-vars byte-compile-warnings)
413 (setq byte-compile-bound-variables
414 (cons (nth 1 (nth 1 form)) byte-compile-bound-variables)))
415 (if (memq ':version (nthcdr 4 form))
416 ;; Make the variable uncustomizable.
417 `(defvar ,(nth 1 (nth 1 form)) ,(nth 1 (nth 2 form))
418 ,(substring (nth 3 form) (if (string-match "^[\t *]+" (nth 3 form))
421 ;; Ignore unsupported keyword(s).
422 (if (memq ':set-after (nthcdr 4 form))
423 (let ((newform (list (car form) (nth 1 form)
424 (nth 2 form) (nth 3 form)))
425 (args (nthcdr 4 form)))
427 (or (eq (car args) ':set-after)
428 (setq newform (nconc newform (list (car args)
430 (setq args (cdr (cdr args))))
434 (defadvice byte-compile-inline-expand (around ignore-built-in-functions
436 "Ignore built-in functions."
437 (let* ((name (car form))
438 (fn (and (fboundp name)
439 (symbol-function name))))
441 ;; Give up on inlining.
442 (setq ad-return-value form)
445 ;; Unknown variables and functions.
446 (unless (boundp 'buffer-file-coding-system)
447 (defvar buffer-file-coding-system (symbol-value 'file-coding-system)))
448 (unless (featurep 'xemacs)
449 (defalias 'Custom-make-dependencies 'ignore)
450 (defalias 'update-autoloads-from-directory 'ignore))
452 (defalias 'device-sound-enabled-p 'ignore)
453 (defalias 'play-sound-file 'ignore)
454 (defalias 'nndb-request-article 'ignore)
455 (defalias 'efs-re-read-dir 'ignore)
456 (defalias 'ange-ftp-re-read-dir 'ignore)
457 (defalias 'define-mail-user-agent 'ignore)
459 (defconst dgnushack-unexporting-files
460 (append '("dgnushack.el" "dgnuspath.el" "dgnuskwds.el" "lpath.el")
462 (progn (require 'shimbun) nil)
463 (error '("nnshimbun.el")))
464 (unless (or (condition-case code
467 (message "No w3: %s%s, retrying..."
468 (error-message-string code)
469 (if (setq code (locate-library "w3-parse"))
470 (concat " (" code ")")
473 ;; Maybe mis-configured Makefile is used (e.g.
474 ;; configured for FSFmacs but XEmacs is running).
475 (let ((lp (delete dgnushack-w3-directory
476 (copy-sequence load-path))))
477 (if (let ((load-path lp))
481 ;; If success, fix `load-path' for compiling.
484 (message " => fixed; W3DIR=%s"
486 (locate-library "w3-parse")))
488 (message " => ignored")
490 '("nnultimate.el" "webmail.el" "nnwfm.el"))
492 (progn (require 'mh-e) nil)
494 (message "No mh-e: %s%s (ignored)"
495 (error-message-string code)
496 (if (setq code (locate-library "mh-e"))
497 (concat " (" code ")")
501 (progn (require 'xml) nil)
503 (message "No xml: %s%s (ignored)"
504 (error-message-string code)
505 (if (setq code (locate-library "xml"))
506 (concat " (" code ")")
510 (progn (require 'bbdb) nil)
512 (message "No bbdb: %s%s (ignored)"
513 (error-message-string code)
514 (if (setq code (locate-library "bbdb"))
515 (concat " (" code ")")
518 (unless (featurep 'xemacs)
519 '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el"))
520 (when (and (not (featurep 'xemacs))
521 (<= emacs-major-version 20))
523 (when (and (fboundp 'base64-decode-string)
524 (subrp (symbol-function 'base64-decode-string)))
526 (when (and (fboundp 'md5) (subrp (symbol-function 'md5)))
528 (unless (boundp 'MULE)
530 "Files which will not be installed.")
532 (defconst dgnushack-exporting-files
533 (let ((files (directory-files srcdir nil "^[^=].*\\.el$" t)))
534 (dolist (file dgnushack-unexporting-files)
535 (setq files (delete file files)))
536 (sort files 'string-lessp))
537 "Files which will be compiled and installed.")
539 (defun dgnushack-exporting-files ()
540 "Print name of files which will be installed."
541 (princ (mapconcat 'identity dgnushack-exporting-files " ")))
543 (defun dgnushack-compile (&optional warn)
544 ;;(setq byte-compile-dynamic t)
546 (setq byte-compile-warnings
547 '(free-vars unresolved callargs redefine)))
548 (unless (locate-library "cus-edit")
549 (error "You do not seem to have Custom installed.
550 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
551 You also then need to add the following to the lisp/dgnushack.el file:
553 (push \"~/lisp/custom\" load-path)
555 Modify to suit your needs."))
558 (message "load-path=(\"%s\")"
559 (mapconcat 'identity load-path "\"\n \""))
561 (dolist (file dgnushack-exporting-files)
562 (setq file (expand-file-name file srcdir))
563 (when (and (file-exists-p
564 (setq elc (concat (file-name-nondirectory file) "c")))
565 (file-newer-than-file-p file elc))
568 (let ((files dgnushack-exporting-files)
569 ;;(byte-compile-generate-call-tree t)
571 ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
573 (when (featurep 'xemacs)
574 (setq gnus-xmas-glyph-directory "dummy"))
575 (while (setq file (pop files))
576 (setq file (expand-file-name file srcdir))
577 (when (or (not (file-exists-p
578 (setq elc (concat (file-name-nondirectory file) "c"))))
579 (file-newer-than-file-p file elc))
581 (byte-compile-file file))))))
583 (defun dgnushack-recompile ()
585 (byte-recompile-directory "." 0))
587 (defvar dgnushack-gnus-load-file (expand-file-name "gnus-load.el" srcdir))
588 (defvar dgnushack-cus-load-file (expand-file-name "cus-load.el" srcdir))
589 (defvar dgnushack-auto-load-file (expand-file-name "auto-autoloads.el" srcdir))
591 (defun dgnushack-make-cus-load ()
592 (when (condition-case nil
595 (let ((cusload-base-file dgnushack-cus-load-file))
596 (if (fboundp 'custom-make-dependencies)
597 (custom-make-dependencies)
598 (Custom-make-dependencies)))))
600 (defun dgnushack-make-auto-load ()
602 (unless (make-autoload '(define-derived-mode child parent name
605 (defadvice make-autoload (around handle-define-derived-mode activate)
606 "Handle `define-derived-mode'."
607 (if (eq (car-safe (ad-get-arg 0)) 'define-derived-mode)
608 (setq ad-return-value
610 (list 'quote (nth 1 (ad-get-arg 0)))
612 (nth 4 (ad-get-arg 0))
615 (put 'define-derived-mode 'doc-string-elt 3))
616 (let ((generated-autoload-file dgnushack-gnus-load-file)
617 (make-backup-files nil)
618 (autoload-package-name "gnus"))
619 (if (featurep 'xemacs)
621 (if (file-exists-p generated-autoload-file)
622 (delete-file generated-autoload-file))
623 (if (file-exists-p dgnushack-auto-load-file)
624 (delete-file dgnushack-auto-load-file)))
625 (with-temp-file generated-autoload-file
627 (if (featurep 'xemacs)
628 (let ((si:message (symbol-function 'message)))
629 (defun message (fmt &rest args)
630 (cond ((and (string-equal "Generating autoloads for %s..." fmt)
631 (file-exists-p (file-name-nondirectory (car args))))
633 fmt (file-name-nondirectory (car args))))
634 ((string-equal "No autoloads found in %s" fmt))
635 ((string-equal "Generating autoloads for %s...done" fmt))
636 (t (apply si:message fmt args))))
638 (batch-update-autoloads)
639 (fset 'message si:message)))
640 (batch-update-autoloads))))
642 (defun dgnushack-make-load ()
643 (message (format "Generating %s..." dgnushack-gnus-load-file))
644 (with-temp-file dgnushack-gnus-load-file
645 (if (file-exists-p dgnushack-cus-load-file)
647 (insert-file-contents dgnushack-cus-load-file)
648 (delete-file dgnushack-cus-load-file)
649 (goto-char (point-min))
650 (search-forward ";;; Code:")
652 (delete-region (point-min) (point))
653 (unless (re-search-forward "\
654 ^[\t ]*(autoload[\t\n ]+\\('\\|(quote[\t\n ]+\\)custom-add-loads[\t\n ]"
656 (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))
657 (goto-char (point-min))
659 ;;; gnus-load.el --- automatically extracted custom dependencies and autoload
663 (goto-char (point-max))
664 (if (search-backward "custom-versions-load-alist" nil t)
667 (while (eq (char-after) ?\;)
670 (delete-region (point) (point-max))
673 ;;; gnus-load.el --- automatically extracted autoload
677 ;; smiley-* are duplicated. Remove them all.
678 (let ((point (point)))
679 (insert-file-contents dgnushack-gnus-load-file)
681 (while (search-forward "smiley-" nil t)
683 (if (looking-at "(autoload ")
684 (delete-region (point) (progn (forward-sexp) (point)))
687 (goto-char (point-max))
688 (when (search-backward "\n(provide " nil t)
690 (delete-region (point) (point-max)))
693 \(provide 'gnus-load)
696 ;;; version-control: never
697 ;;; no-byte-compile: t
698 ;;; no-update-autoloads: t
700 ;;; gnus-load.el ends here
702 ;; Workaround the bug in some version of XEmacs.
703 (when (featurep 'xemacs)
707 (goto-char (point-min))
708 (when (and (fboundp 'custom-add-loads)
709 (not (search-forward "\n(autoload 'custom-add-loads " nil t)))
710 (search-forward "\n;;; Code:" nil t)
712 (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))))
713 (message (format "Compiling %s..." dgnushack-gnus-load-file))
714 (byte-compile-file dgnushack-gnus-load-file))
717 (defun dgnushack-compose-package ()
718 "Re-split the file gnus-load.el into custom-load.el and
719 auto-autoloads.el. It is silly, should be improved!"
721 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...")
722 (let ((customload (expand-file-name "custom-load.el" srcdir))
723 (autoloads (expand-file-name "auto-autoloads.el" srcdir))
726 (insert-file-contents dgnushack-gnus-load-file)
727 (delete-file dgnushack-gnus-load-file)
728 (when (file-exists-p (concat dgnushack-gnus-load-file "c"))
729 (delete-file (concat dgnushack-gnus-load-file "c")))
731 (looking-at "[\t ;]")
735 ;;; custom-load.el --- automatically extracted custom dependencies\n
737 (goto-char (point-max))
740 (not (looking-at "[\t ]*(custom-add-loads[\t\n ]"))))
743 (insert "\n;;; custom-load.el ends here\n")
744 (write-region start (point) customload)
745 (while (looking-at "[\t ]*$")
748 (if (re-search-forward "^[\t\n ]*(if[\t\n ]+(featurep[\t\n ]" nil t)
749 (let ((from (goto-char (match-beginning 0))))
750 (delete-region from (progn
754 (while (looking-at "[\t ;]")
756 (insert "(if (featurep 'gnus-autoloads) (error \"Already loaded\"))\n")
757 (goto-char (point-max))
760 (not (looking-at "[\t ]*(provide[\t\n ]"))))
761 (insert "(provide 'gnus-autoloads)\n")
762 (write-region start (point) autoloads))
763 (byte-compile-file customload)
764 (byte-compile-file autoloads))
766 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...done
770 (defconst dgnushack-info-file-regexp-en
771 (let ((names '("gnus" "message" "emacs-mime"))
773 (while (setq name (pop names))
774 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
775 (when names "\\|"))))
777 "Regexp matching English info files.")
779 (defconst dgnushack-info-file-regexp-ja
780 (let ((names '("gnus-ja" "message-ja"))
782 (while (setq name (pop names))
783 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
784 (when names "\\|"))))
786 "Regexp matching Japanese info files.")
788 (defun dgnushack-remove-extra-files-in-package ()
789 "Remove extra files in the lisp directory of the XEmacs package."
790 (let ((lisp-dir (expand-file-name (concat "lisp/"
792 (cadr command-line-args-left)
795 (car command-line-args-left))))
796 (when (file-directory-p lisp-dir)
798 (dolist (file dgnushack-exporting-files)
799 (setq files (nconc files (list file (concat file "c")))))
800 (dolist (file (directory-files lisp-dir nil nil t t))
801 (unless (member file files)
802 (setq file (expand-file-name file lisp-dir))
803 (message "Removing %s..." file)
808 (defun dgnushack-install-package-manifest ()
809 "Install MANIFEST file as an XEmacs package."
810 (let* ((package-dir (car command-line-args-left))
811 (product-name (cadr command-line-args-left))
812 (name (expand-file-name (concat "pkginfo/MANIFEST." product-name)
815 (message "Generating %s..." name)
817 (insert "pkginfo/MANIFEST." product-name "\n")
818 (let ((lisp-dir (concat "lisp/" product-name "/"))
819 (files (sort (directory-files "." nil "\\.elc?$" t) 'string-lessp))
821 (while (setq file (pop files))
822 (unless (member file dgnushack-unexporting-files)
823 (insert lisp-dir file "\n")))
825 (sort (directory-files "../texi/" nil
826 (concat dgnushack-info-file-regexp-en
828 dgnushack-info-file-regexp-ja)
831 (while (setq file (pop files))
832 (insert "info/" file "\n"))))))
835 (define-compiler-macro describe-key-briefly (&whole form key &optional insert)
836 (if (condition-case nil
838 (describe-key-briefly '((())) nil)
840 (wrong-number-of-arguments nil);; Old Emacsen.
845 (insert (funcall 'describe-key-briefly ,key))
846 (funcall 'describe-key-briefly ,key))
847 `(funcall 'describe-key-briefly ,key))))
849 ;;; dgnushack.el ends here