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)
349 defcustom defface defgroup
350 define-widget quote))
352 (push (car elem) form)
353 (setq elem (cdr elem)))
357 (eq ?: (aref (symbol-name elem) 0))
358 (not (memq elem ignores))
359 (not (memq elem keywords)))
360 (push elem keywords))))))))
361 (setq keywords (sort keywords
363 (string-lessp (symbol-name a)
366 (insert (format "%s" keywords))
367 (write-region (point-min) (point) cache nil 'silent)
369 "The following colon keywords will be bound at run-time:\n %s"
372 (defconst dgnushack-colon-keywords keywords)
374 (set (car keywords) (car keywords))
375 (setq keywords (cdr keywords)))))
376 (byte-compile 'dgnushack-bind-colon-keywords)
377 (dgnushack-bind-colon-keywords)))
380 (setq :version ':version
381 :set-after ':set-after)
383 (defadvice custom-handle-keyword
384 (around dont-signal-an-error-even-if-unsupported-keyword-is-given
386 "Don't signal an error even if unsupported keyword is given."
387 (if (not (memq (ad-get-arg 1) '(:version :set-after)))
391 (put 'custom-declare-face 'byte-optimizer
392 'byte-optimize-ignore-unsupported-custom-keywords)
393 (put 'custom-declare-group 'byte-optimizer
394 'byte-optimize-ignore-unsupported-custom-keywords)
395 (defun byte-optimize-ignore-unsupported-custom-keywords (form)
396 (if (or (memq ':version (nthcdr 4 form))
397 (memq ':set-after (nthcdr 4 form)))
398 (let ((newform (list (car form) (nth 1 form)
399 (nth 2 form) (nth 3 form)))
400 (args (nthcdr 4 form)))
402 (or (memq (car args) '(:version :set-after))
403 (setq newform (nconc newform (list (car args)
405 (setq args (cdr (cdr args))))
409 (put 'custom-declare-variable 'byte-hunk-handler
410 'byte-compile-file-form-custom-declare-variable)
411 (defun byte-compile-file-form-custom-declare-variable (form)
412 ;; Bind defcustom'ed variables.
413 (if (memq 'free-vars byte-compile-warnings)
414 (setq byte-compile-bound-variables
415 (cons (nth 1 (nth 1 form)) byte-compile-bound-variables)))
416 (if (memq ':version (nthcdr 4 form))
417 ;; Make the variable uncustomizable.
418 `(defvar ,(nth 1 (nth 1 form)) ,(nth 1 (nth 2 form))
419 ,(substring (nth 3 form) (if (string-match "^[\t *]+" (nth 3 form))
422 ;; Ignore unsupported keyword(s).
423 (if (memq ':set-after (nthcdr 4 form))
424 (let ((newform (list (car form) (nth 1 form)
425 (nth 2 form) (nth 3 form)))
426 (args (nthcdr 4 form)))
428 (or (eq (car args) ':set-after)
429 (setq newform (nconc newform (list (car args)
431 (setq args (cdr (cdr args))))
435 (defadvice byte-compile-inline-expand (around ignore-built-in-functions
437 "Ignore built-in functions."
438 (let* ((name (car form))
439 (fn (and (fboundp name)
440 (symbol-function name))))
442 ;; Give up on inlining.
443 (setq ad-return-value form)
446 ;; Unknown variables and functions.
447 (unless (boundp 'buffer-file-coding-system)
448 (defvar buffer-file-coding-system (symbol-value 'file-coding-system)))
449 (unless (featurep 'xemacs)
450 (defalias 'Custom-make-dependencies 'ignore)
451 (defalias 'update-autoloads-from-directory 'ignore))
453 (defalias 'device-sound-enabled-p 'ignore)
454 (defalias 'play-sound-file 'ignore)
455 (defalias 'nndb-request-article 'ignore)
456 (defalias 'efs-re-read-dir 'ignore)
457 (defalias 'ange-ftp-re-read-dir 'ignore)
458 (defalias 'define-mail-user-agent 'ignore)
460 (defconst dgnushack-unexporting-files
461 (append '("dgnushack.el" "dgnuspath.el" "dgnuskwds.el" "lpath.el")
463 (progn (require 'shimbun) nil)
464 (error '("nnshimbun.el")))
465 (unless (or (condition-case code
468 (message "No w3: %s%s, retrying..."
469 (error-message-string code)
470 (if (setq code (locate-library "w3-parse"))
471 (concat " (" code ")")
474 ;; Maybe mis-configured Makefile is used (e.g.
475 ;; configured for FSFmacs but XEmacs is running).
476 (let ((lp (delete dgnushack-w3-directory
477 (copy-sequence load-path))))
478 (if (let ((load-path lp))
482 ;; If success, fix `load-path' for compiling.
485 (message " => fixed; W3DIR=%s"
487 (locate-library "w3-parse")))
489 (message " => ignored")
491 '("nnultimate.el" "webmail.el" "nnwfm.el"))
493 (progn (require 'mh-e) nil)
495 (message "No mh-e: %s%s (ignored)"
496 (error-message-string code)
497 (if (setq code (locate-library "mh-e"))
498 (concat " (" code ")")
502 (progn (require 'xml) nil)
504 (message "No xml: %s%s (ignored)"
505 (error-message-string code)
506 (if (setq code (locate-library "xml"))
507 (concat " (" code ")")
511 (progn (require 'bbdb) nil)
513 (message "No bbdb: %s%s (ignored)"
514 (error-message-string code)
515 (if (setq code (locate-library "bbdb"))
516 (concat " (" code ")")
519 (unless (featurep 'xemacs)
520 '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el"))
521 (when (and (not (featurep 'xemacs))
522 (<= emacs-major-version 20))
524 (when (and (fboundp 'base64-decode-string)
525 (subrp (symbol-function 'base64-decode-string)))
527 (when (and (fboundp 'md5) (subrp (symbol-function 'md5)))
529 (unless (boundp 'MULE)
531 "Files which will not be installed.")
533 (defconst dgnushack-exporting-files
534 (let ((files (directory-files srcdir nil "^[^=].*\\.el$" t)))
535 (dolist (file dgnushack-unexporting-files)
536 (setq files (delete file files)))
537 (sort files 'string-lessp))
538 "Files which will be compiled and installed.")
540 (defun dgnushack-exporting-files ()
541 "Print name of files which will be installed."
542 (princ (mapconcat 'identity dgnushack-exporting-files " ")))
544 (defun dgnushack-compile (&optional warn)
545 ;;(setq byte-compile-dynamic t)
547 (setq byte-compile-warnings
548 '(free-vars unresolved callargs redefine)))
549 (unless (locate-library "cus-edit")
550 (error "You do not seem to have Custom installed.
551 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
552 You also then need to add the following to the lisp/dgnushack.el file:
554 (push \"~/lisp/custom\" load-path)
556 Modify to suit your needs."))
559 (message "load-path=(\"%s\")"
560 (mapconcat 'identity load-path "\"\n \""))
562 (dolist (file dgnushack-exporting-files)
563 (setq file (expand-file-name file srcdir))
564 (when (and (file-exists-p
565 (setq elc (concat (file-name-nondirectory file) "c")))
566 (file-newer-than-file-p file elc))
569 (let ((files dgnushack-exporting-files)
570 ;;(byte-compile-generate-call-tree t)
572 ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
574 (when (featurep 'xemacs)
575 (setq gnus-xmas-glyph-directory "dummy"))
576 (while (setq file (pop files))
577 (setq file (expand-file-name file srcdir))
578 (when (or (not (file-exists-p
579 (setq elc (concat (file-name-nondirectory file) "c"))))
580 (file-newer-than-file-p file elc))
582 (byte-compile-file file))))))
584 (defun dgnushack-recompile ()
586 (byte-recompile-directory "." 0))
588 (defvar dgnushack-gnus-load-file (expand-file-name "gnus-load.el" srcdir))
589 (defvar dgnushack-cus-load-file (expand-file-name "cus-load.el" srcdir))
590 (defvar dgnushack-auto-load-file (expand-file-name "auto-autoloads.el" srcdir))
592 (defun dgnushack-make-cus-load ()
593 (when (condition-case nil
596 (let ((cusload-base-file dgnushack-cus-load-file))
597 (if (fboundp 'custom-make-dependencies)
598 (custom-make-dependencies)
599 (Custom-make-dependencies)))))
601 (defun dgnushack-make-auto-load ()
603 (unless (make-autoload '(define-derived-mode child parent name
606 (defadvice make-autoload (around handle-define-derived-mode activate)
607 "Handle `define-derived-mode'."
608 (if (eq (car-safe (ad-get-arg 0)) 'define-derived-mode)
609 (setq ad-return-value
611 (list 'quote (nth 1 (ad-get-arg 0)))
613 (nth 4 (ad-get-arg 0))
616 (put 'define-derived-mode 'doc-string-elt 3))
617 (let ((generated-autoload-file dgnushack-gnus-load-file)
618 (make-backup-files nil)
619 (autoload-package-name "gnus"))
620 (if (featurep 'xemacs)
622 (if (file-exists-p generated-autoload-file)
623 (delete-file generated-autoload-file))
624 (if (file-exists-p dgnushack-auto-load-file)
625 (delete-file dgnushack-auto-load-file)))
626 (with-temp-file generated-autoload-file
628 (if (featurep 'xemacs)
629 (let ((si:message (symbol-function 'message)))
630 (defun message (fmt &rest args)
631 (cond ((and (string-equal "Generating autoloads for %s..." fmt)
632 (file-exists-p (file-name-nondirectory (car args))))
634 fmt (file-name-nondirectory (car args))))
635 ((string-equal "No autoloads found in %s" fmt))
636 ((string-equal "Generating autoloads for %s...done" fmt))
637 (t (apply si:message fmt args))))
639 (batch-update-autoloads)
640 (fset 'message si:message)))
641 (batch-update-autoloads))))
643 (defun dgnushack-make-load ()
644 (message (format "Generating %s..." dgnushack-gnus-load-file))
645 (with-temp-file dgnushack-gnus-load-file
646 (if (file-exists-p dgnushack-cus-load-file)
648 (insert-file-contents dgnushack-cus-load-file)
649 (delete-file dgnushack-cus-load-file)
650 (goto-char (point-min))
651 (search-forward ";;; Code:")
653 (delete-region (point-min) (point))
654 (unless (re-search-forward "\
655 ^[\t ]*(autoload[\t\n ]+\\('\\|(quote[\t\n ]+\\)custom-add-loads[\t\n ]"
657 (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))
658 (goto-char (point-min))
660 ;;; gnus-load.el --- automatically extracted custom dependencies and autoload
664 (goto-char (point-max))
665 (if (search-backward "custom-versions-load-alist" nil t)
668 (while (eq (char-after) ?\;)
671 (delete-region (point) (point-max))
674 ;;; gnus-load.el --- automatically extracted autoload
678 ;; smiley-* are duplicated. Remove them all.
679 (let ((point (point)))
680 (insert-file-contents dgnushack-gnus-load-file)
682 (while (search-forward "smiley-" nil t)
684 (if (looking-at "(autoload ")
685 (delete-region (point) (progn (forward-sexp) (point)))
688 (goto-char (point-max))
689 (when (search-backward "\n(provide " nil t)
691 (delete-region (point) (point-max)))
694 \(provide 'gnus-load)
697 ;;; version-control: never
698 ;;; no-byte-compile: t
699 ;;; no-update-autoloads: t
701 ;;; gnus-load.el ends here
703 ;; Workaround the bug in some version of XEmacs.
704 (when (featurep 'xemacs)
708 (goto-char (point-min))
709 (when (and (fboundp 'custom-add-loads)
710 (not (search-forward "\n(autoload 'custom-add-loads " nil t)))
711 (search-forward "\n;;; Code:" nil t)
713 (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))))
714 (message (format "Compiling %s..." dgnushack-gnus-load-file))
715 (byte-compile-file dgnushack-gnus-load-file))
718 (defun dgnushack-compose-package ()
719 "Re-split the file gnus-load.el into custom-load.el and
720 auto-autoloads.el. It is silly, should be improved!"
722 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...")
723 (let ((customload (expand-file-name "custom-load.el" srcdir))
724 (autoloads (expand-file-name "auto-autoloads.el" srcdir))
727 (insert-file-contents dgnushack-gnus-load-file)
728 (delete-file dgnushack-gnus-load-file)
729 (when (file-exists-p (concat dgnushack-gnus-load-file "c"))
730 (delete-file (concat dgnushack-gnus-load-file "c")))
732 (looking-at "[\t ;]")
736 ;;; custom-load.el --- automatically extracted custom dependencies\n
738 (goto-char (point-max))
741 (not (looking-at "[\t ]*(custom-add-loads[\t\n ]"))))
744 (insert "\n;;; custom-load.el ends here\n")
745 (write-region start (point) customload)
746 (while (looking-at "[\t ]*$")
749 (if (re-search-forward "^[\t\n ]*(if[\t\n ]+(featurep[\t\n ]" nil t)
750 (let ((from (goto-char (match-beginning 0))))
751 (delete-region from (progn
755 (while (looking-at "[\t ;]")
757 (insert "(if (featurep 'gnus-autoloads) (error \"Already loaded\"))\n")
758 (goto-char (point-max))
761 (not (looking-at "[\t ]*(provide[\t\n ]"))))
762 (insert "(provide 'gnus-autoloads)\n")
763 (write-region start (point) autoloads))
764 (byte-compile-file customload)
765 (byte-compile-file autoloads))
767 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...done
771 (defconst dgnushack-info-file-regexp-en
772 (let ((names '("gnus" "message" "emacs-mime"))
774 (while (setq name (pop names))
775 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
776 (when names "\\|"))))
778 "Regexp matching English info files.")
780 (defconst dgnushack-info-file-regexp-ja
781 (let ((names '("gnus-ja" "message-ja"))
783 (while (setq name (pop names))
784 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
785 (when names "\\|"))))
787 "Regexp matching Japanese info files.")
789 (defun dgnushack-remove-extra-files-in-package ()
790 "Remove extra files in the lisp directory of the XEmacs package."
791 (let ((lisp-dir (expand-file-name (concat "lisp/"
793 (cadr command-line-args-left)
796 (car command-line-args-left))))
797 (when (file-directory-p lisp-dir)
799 (dolist (file dgnushack-exporting-files)
800 (setq files (nconc files (list file (concat file "c")))))
801 (dolist (file (directory-files lisp-dir nil nil t t))
802 (unless (member file files)
803 (setq file (expand-file-name file lisp-dir))
804 (message "Removing %s..." file)
809 (defun dgnushack-install-package-manifest ()
810 "Install MANIFEST file as an XEmacs package."
811 (let* ((package-dir (car command-line-args-left))
812 (product-name (cadr command-line-args-left))
813 (name (expand-file-name (concat "pkginfo/MANIFEST." product-name)
816 (message "Generating %s..." name)
818 (insert "pkginfo/MANIFEST." product-name "\n")
819 (let ((lisp-dir (concat "lisp/" product-name "/"))
820 (files (sort (directory-files "." nil "\\.elc?$" t) 'string-lessp))
822 (while (setq file (pop files))
823 (unless (member file dgnushack-unexporting-files)
824 (insert lisp-dir file "\n")))
826 (sort (directory-files "../texi/" nil
827 (concat dgnushack-info-file-regexp-en
829 dgnushack-info-file-regexp-ja)
832 (while (setq file (pop files))
833 (insert "info/" file "\n"))))))
836 (define-compiler-macro describe-key-briefly (&whole form key &optional insert)
837 (if (condition-case nil
839 (describe-key-briefly '((())) nil)
841 (wrong-number-of-arguments nil);; Old Emacsen.
846 (insert (funcall 'describe-key-briefly ,key))
847 (funcall 'describe-key-briefly ,key))
848 `(funcall 'describe-key-briefly ,key))))
850 ;;; dgnushack.el ends here