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 (setq max-specpdl-size 3000)
134 (message "The subform `(< 0 1)' should be optimized to `t'"))
137 (defadvice byte-optimize-form-code-walker
138 (around fix-bug-in-and/or-forms (form for-effect) activate)
139 "Fix a bug in the optimizing and/or forms.
140 It has already been fixed in XEmacs since 1999-12-06."
141 (if (and for-effect (memq (car-safe form) '(and or)))
142 (let ((fn (car form))
143 (backwards (reverse (cdr form))))
144 (while (and backwards
145 (null (setcar backwards
146 (byte-optimize-form (car backwards) t))))
147 (setq backwards (cdr backwards)))
148 (if (and (cdr form) (null backwards))
150 " all subforms of %s called for effect; deleted" form))
153 (mapcar 'byte-optimize-form (cdr backwards))))
154 (setq ad-return-value (cons fn (nreverse backwards))))
159 (wrong-number-of-arguments
160 ;; Optimize byte code for `char-after'.
161 (put 'char-after 'byte-optimizer 'byte-optimize-char-after)
162 (defun byte-optimize-char-after (form)
163 (if (null (cdr form))
164 '(char-after (point))
169 (wrong-number-of-arguments
170 ;; Optimize byte code for `char-before'.
171 (put 'char-before 'byte-optimizer 'byte-optimize-char-before)
172 (defun byte-optimize-char-before (form)
173 (if (null (cdr form))
174 '(char-before (point))
177 (load (expand-file-name "dgnuspath.el" srcdir) nil nil t)
180 (load "~/.lpath.el" t nil t)
181 (error (message "Error in \"~/.lpath.el\" file: %s" err)))
183 ;; Don't load path-util until `char-after' and `char-before' have been
184 ;; optimized because it requires `poe' and then modify the functions.
186 ;; If the APEL modules are installed under the non-standard directory,
187 ;; for example "/var/home/john/lisp/apel-VERSION/", you should add that
188 ;; name using the configure option "--with-addpath=".
189 ;; And also the directory where the EMU modules are installed, for
190 ;; example "/usr/local/share/mule/19.34/site-lisp/", it should be
191 ;; included in the standard `load-path' or added by the configure
192 ;; option "--with-addpath=".
193 (let ((path (or (locate-library "path-util")
194 (locate-library "apel/path-util")));; backward compat.
198 (when (string-match "/$" (setq path (file-name-directory path)))
199 (setq path (substring path 0 (match-beginning 0))))
200 ;; path == "/var/home/john/lisp/apel-VERSION"
201 (when (string-match "/$" (setq parent (file-name-directory path)))
202 (setq parent (substring path 0 (match-beginning 0))))
203 ;; parent == "/var/home/john/lisp"
204 (if (setq lpath (or (member path load-path)
205 (member (file-name-as-directory path) load-path)))
206 (unless (or (member parent load-path)
207 (member (file-name-as-directory parent) load-path))
208 (push parent (cdr lpath)))
209 (push path load-path)
210 (unless (or (member parent load-path)
211 (member (file-name-as-directory parent) load-path))
212 (push parent (cdr load-path))))
213 (require 'path-util))
215 APEL modules are not found in %s.
216 Try to re-configure with --with-addpath=APEL_PATH and run make again.
220 (unless (locate-library "mel")
222 (unless (module-installed-p 'mel)
223 ;; FLIM 1.14 may have installed in two "flim" subdirectories.
224 (push (expand-file-name "flim"
225 (file-name-directory (get-latest-path "^apel$" t)))
227 (unless (module-installed-p 'mel)
229 FLIM modules does not found in %s.
230 Try to re-configure with --with-addpath=FLIM_PATH and run make again.
235 (push srcdir load-path)
236 (load (expand-file-name "lpath.el" srcdir) nil t t)
238 (load (expand-file-name "gnus-clfns.el" srcdir) nil t t)
241 ;; Bind the function `base64-encode-string' before loading canlock.
242 ;; Since canlock will bind it as an autoloaded function, it causes
243 ;; damage to define the function by MEL.
244 (load (expand-file-name "base64.el" srcdir) nil t t)
245 ;; Load special macros for compiling canlock.el.
246 (load (expand-file-name "canlock-om.el" srcdir) nil t t))
250 ;; Bind functions defined by `defun-maybe'.
251 (put 'defun-maybe 'byte-hunk-handler 'byte-compile-file-form-defun-maybe)
252 (defun byte-compile-file-form-defun-maybe (form)
253 (if (and (not (fboundp (nth 1 form)))
254 (memq 'unresolved byte-compile-warnings))
255 (setq byte-compile-function-environment
256 (cons (cons (nth 1 form)
257 (cons 'lambda (cdr (cdr form))))
258 byte-compile-function-environment)))
262 :symbol-for-testing-whether-colon-keyword-is-available-or-not
264 (defun dgnushack-bind-colon-keywords ()
265 "Bind all the colon keywords for old Emacsen."
266 (let ((cache (expand-file-name "dgnuskwds.el" srcdir))
267 (makefile (expand-file-name "Makefile" srcdir))
268 (buffer (get-buffer-create " *colon keywords*"))
269 keywords ignores files file dirs dir form elem make-backup-files)
272 (let (buffer-file-format
274 insert-file-contents-post-hook
275 insert-file-contents-pre-hook
276 jam-zcat-filename-list
277 jka-compr-compression-info-list)
278 (if (and (file-exists-p cache)
279 (file-exists-p makefile)
280 (file-newer-than-file-p cache makefile))
282 (insert-file-contents cache nil nil nil t)
283 (setq keywords (read buffer)))
286 '(:symbol-for-testing-whether-colon-keyword-is-available-or-not
287 ;; The following keywords will be bound by CUSTOM.
288 :get :group :initialize :link :load :options :prefix
289 :require :set :tag :type)
290 files (list (locate-library "semi-def")
291 (locate-library "mailcap")
292 (locate-library "mime-def")
293 (locate-library "path-util")
294 (locate-library "poem"))
295 dirs (list (file-name-as-directory (expand-file-name srcdir))))
297 (when (setq file (pop files))
298 (setq dir (file-name-directory file))
299 (unless (member dir dirs)
301 (message "Searching for all the colon keywords in:")
303 (setq dir (pop dirs))
304 (message " %s..." dir)
305 (setq files (directory-files dir t
306 "\\.el\\(\\.gz\\|\\.bz2\\)?$"))
308 (setq file (pop files))
309 (if (string-match "\\(\\.gz$\\)\\|\\.bz2$" file)
310 (let ((temp (expand-file-name "dgnustemp.el" srcdir)))
312 (let* ((binary (if (boundp 'MULE)
315 (coding-system-for-read binary)
316 (coding-system-for-write binary)
317 (input-coding-system binary)
318 (output-coding-system binary)
319 (default-process-coding-system
320 (cons binary binary))
322 (insert-file-contents file nil nil nil t)
326 (if (match-beginning 1)
328 (point-min) (point-max)
329 "gzip" t buffer nil "-cd")
331 (point-min) (point-max)
332 "bzip2" t buffer nil "-d"))
336 (message "In file %s: %s" file code)
338 (write-region (point-min) (point-max) temp
342 (insert-file-contents temp nil nil nil t)
343 (delete-file temp))))
344 (insert-file-contents file nil nil nil t))
345 (while (setq form (condition-case nil
350 (setq elem (car-safe form)
351 form (cdr-safe form))
352 (unless (memq (car-safe elem)
353 '(defcustom defface defgroup
354 define-widget quote))
356 (push (car elem) form)
357 (setq elem (cdr elem)))
361 (eq ?: (aref (symbol-name elem) 0))
362 (not (memq elem ignores))
363 (not (memq elem keywords)))
364 (push elem keywords))))))))
365 (setq keywords (sort keywords
367 (string-lessp (symbol-name a)
370 (insert (format "%s" keywords))
371 (write-region (point-min) (point) cache nil 'silent)
373 "The following colon keywords will be bound at run-time:\n %s"
376 (defconst dgnushack-colon-keywords keywords)
378 (set (car keywords) (car keywords))
379 (setq keywords (cdr keywords)))))
380 (byte-compile 'dgnushack-bind-colon-keywords)
381 (dgnushack-bind-colon-keywords)))
384 (setq :version ':version
385 :set-after ':set-after)
387 (defadvice custom-handle-keyword
388 (around dont-signal-an-error-even-if-unsupported-keyword-is-given
390 "Don't signal an error even if unsupported keyword is given."
391 (if (not (memq (ad-get-arg 1) '(:version :set-after)))
395 (put 'custom-declare-face 'byte-optimizer
396 'byte-optimize-ignore-unsupported-custom-keywords)
397 (put 'custom-declare-group 'byte-optimizer
398 'byte-optimize-ignore-unsupported-custom-keywords)
399 (defun byte-optimize-ignore-unsupported-custom-keywords (form)
400 (if (or (memq ':version (nthcdr 4 form))
401 (memq ':set-after (nthcdr 4 form)))
402 (let ((newform (list (car form) (nth 1 form)
403 (nth 2 form) (nth 3 form)))
404 (args (nthcdr 4 form)))
406 (or (memq (car args) '(:version :set-after))
407 (setq newform (nconc newform (list (car args)
409 (setq args (cdr (cdr args))))
413 (put 'custom-declare-variable 'byte-hunk-handler
414 'byte-compile-file-form-custom-declare-variable)
415 (defun byte-compile-file-form-custom-declare-variable (form)
416 ;; Bind defcustom'ed variables.
417 (if (memq 'free-vars byte-compile-warnings)
418 (setq byte-compile-bound-variables
419 (cons (nth 1 (nth 1 form)) byte-compile-bound-variables)))
420 (if (memq ':version (nthcdr 4 form))
421 ;; Make the variable uncustomizable.
422 `(defvar ,(nth 1 (nth 1 form)) ,(nth 1 (nth 2 form))
423 ,(substring (nth 3 form) (if (string-match "^[\t *]+" (nth 3 form))
426 ;; Ignore unsupported keyword(s).
427 (if (memq ':set-after (nthcdr 4 form))
428 (let ((newform (list (car form) (nth 1 form)
429 (nth 2 form) (nth 3 form)))
430 (args (nthcdr 4 form)))
432 (or (eq (car args) ':set-after)
433 (setq newform (nconc newform (list (car args)
435 (setq args (cdr (cdr args))))
439 (defadvice byte-compile-inline-expand (around ignore-built-in-functions
441 "Ignore built-in functions."
442 (let* ((name (car form))
443 (fn (and (fboundp name)
444 (symbol-function name))))
446 ;; Give up on inlining.
447 (setq ad-return-value form)
450 ;; Unknown variables and functions.
451 (unless (boundp 'buffer-file-coding-system)
452 (defvar buffer-file-coding-system (symbol-value 'file-coding-system)))
453 (unless (featurep 'xemacs)
454 (defalias 'Custom-make-dependencies 'ignore)
455 (defalias 'update-autoloads-from-directory 'ignore))
457 (defalias 'device-sound-enabled-p 'ignore)
458 (defalias 'play-sound-file 'ignore)
459 (defalias 'nndb-request-article 'ignore)
460 (defalias 'efs-re-read-dir 'ignore)
461 (defalias 'ange-ftp-re-read-dir 'ignore)
462 (defalias 'define-mail-user-agent 'ignore)
464 (defconst dgnushack-unexporting-files
465 (append '("dgnushack.el" "dgnuspath.el" "dgnuskwds.el" "lpath.el")
467 (progn (require 'shimbun) nil)
468 (error '("nnshimbun.el")))
469 (unless (or (condition-case code
472 (message "No w3: %s%s, retrying..."
473 (error-message-string code)
474 (if (setq code (locate-library "w3-parse"))
475 (concat " (" code ")")
478 ;; Maybe mis-configured Makefile is used (e.g.
479 ;; configured for FSFmacs but XEmacs is running).
480 (let ((lp (delete dgnushack-w3-directory
481 (copy-sequence load-path))))
482 (if (let ((load-path lp))
486 ;; If success, fix `load-path' for compiling.
489 (message " => fixed; W3DIR=%s"
491 (locate-library "w3-parse")))
493 (message " => ignored")
495 '("nnultimate.el" "webmail.el" "nnwfm.el"))
497 (progn (require 'mh-e) nil)
499 (message "No mh-e: %s%s (ignored)"
500 (error-message-string code)
501 (if (setq code (locate-library "mh-e"))
502 (concat " (" code ")")
506 (progn (require 'xml) nil)
508 (message "No xml: %s%s (ignored)"
509 (error-message-string code)
510 (if (setq code (locate-library "xml"))
511 (concat " (" code ")")
515 (progn (require 'bbdb) nil)
517 (message "No bbdb: %s%s (ignored)"
518 (error-message-string code)
519 (if (setq code (locate-library "bbdb"))
520 (concat " (" code ")")
523 (unless (featurep 'xemacs)
524 '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el"))
525 (when (and (not (featurep 'xemacs))
526 (<= emacs-major-version 20))
528 (when (and (fboundp 'base64-decode-string)
529 (subrp (symbol-function 'base64-decode-string)))
531 (when (and (fboundp 'md5) (subrp (symbol-function 'md5)))
533 (unless (boundp 'MULE)
535 "Files which will not be installed.")
537 (defconst dgnushack-exporting-files
538 (let ((files (directory-files srcdir nil "^[^=].*\\.el$" t)))
539 (dolist (file dgnushack-unexporting-files)
540 (setq files (delete file files)))
541 (sort files 'string-lessp))
542 "Files which will be compiled and installed.")
544 (defun dgnushack-exporting-files ()
545 "Print name of files which will be installed."
546 (princ (mapconcat 'identity dgnushack-exporting-files " ")))
548 (defun dgnushack-compile (&optional warn)
549 ;;(setq byte-compile-dynamic t)
551 (setq byte-compile-warnings
552 '(free-vars unresolved callargs redefine)))
553 (unless (locate-library "cus-edit")
554 (error "You do not seem to have Custom installed.
555 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
556 You also then need to add the following to the lisp/dgnushack.el file:
558 (push \"~/lisp/custom\" load-path)
560 Modify to suit your needs."))
563 (message "load-path=(\"%s\")"
564 (mapconcat 'identity load-path "\"\n \""))
566 (dolist (file dgnushack-exporting-files)
567 (setq file (expand-file-name file srcdir))
568 (when (and (file-exists-p
569 (setq elc (concat (file-name-nondirectory file) "c")))
570 (file-newer-than-file-p file elc))
573 (let ((files dgnushack-exporting-files)
574 ;;(byte-compile-generate-call-tree t)
576 ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
578 (when (featurep 'xemacs)
579 (setq gnus-xmas-glyph-directory "dummy"))
580 (while (setq file (pop files))
581 (setq file (expand-file-name file srcdir))
582 (when (or (not (file-exists-p
583 (setq elc (concat (file-name-nondirectory file) "c"))))
584 (file-newer-than-file-p file elc))
586 (byte-compile-file file))))))
588 (defun dgnushack-recompile ()
590 (byte-recompile-directory "." 0))
592 (defvar dgnushack-gnus-load-file (expand-file-name "gnus-load.el" srcdir))
593 (defvar dgnushack-cus-load-file (expand-file-name "cus-load.el" srcdir))
594 (defvar dgnushack-auto-load-file (expand-file-name "auto-autoloads.el" srcdir))
596 (defun dgnushack-make-cus-load ()
597 (when (condition-case nil
600 (let ((cusload-base-file dgnushack-cus-load-file))
601 (if (fboundp 'custom-make-dependencies)
602 (custom-make-dependencies)
603 (Custom-make-dependencies)))))
605 (defun dgnushack-make-auto-load ()
607 (unless (make-autoload '(define-derived-mode child parent name
610 (defadvice make-autoload (around handle-define-derived-mode activate)
611 "Handle `define-derived-mode'."
612 (if (eq (car-safe (ad-get-arg 0)) 'define-derived-mode)
613 (setq ad-return-value
615 (list 'quote (nth 1 (ad-get-arg 0)))
617 (nth 4 (ad-get-arg 0))
620 (put 'define-derived-mode 'doc-string-elt 3))
621 (let ((generated-autoload-file dgnushack-gnus-load-file)
622 (make-backup-files nil)
623 (autoload-package-name "gnus"))
624 (if (featurep 'xemacs)
626 (if (file-exists-p generated-autoload-file)
627 (delete-file generated-autoload-file))
628 (if (file-exists-p dgnushack-auto-load-file)
629 (delete-file dgnushack-auto-load-file)))
630 (with-temp-file generated-autoload-file
632 (if (featurep 'xemacs)
633 (let ((si:message (symbol-function 'message)))
634 (defun message (fmt &rest args)
635 (cond ((and (string-equal "Generating autoloads for %s..." fmt)
636 (file-exists-p (file-name-nondirectory (car args))))
638 fmt (file-name-nondirectory (car args))))
639 ((string-equal "No autoloads found in %s" fmt))
640 ((string-equal "Generating autoloads for %s...done" fmt))
641 (t (apply si:message fmt args))))
643 (batch-update-autoloads)
644 (fset 'message si:message)))
645 (batch-update-autoloads))))
647 (defun dgnushack-make-load ()
648 (message (format "Generating %s..." dgnushack-gnus-load-file))
649 (with-temp-file dgnushack-gnus-load-file
650 (if (file-exists-p dgnushack-cus-load-file)
652 (insert-file-contents dgnushack-cus-load-file)
653 (delete-file dgnushack-cus-load-file)
654 (goto-char (point-min))
655 (search-forward ";;; Code:")
657 (delete-region (point-min) (point))
658 (unless (re-search-forward "\
659 ^[\t ]*(autoload[\t\n ]+\\('\\|(quote[\t\n ]+\\)custom-add-loads[\t\n ]"
661 (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))
662 (goto-char (point-min))
664 ;;; gnus-load.el --- automatically extracted custom dependencies and autoload
668 (goto-char (point-max))
669 (if (search-backward "custom-versions-load-alist" nil t)
672 (while (eq (char-after) ?\;)
675 (delete-region (point) (point-max))
678 ;;; gnus-load.el --- automatically extracted autoload
682 ;; smiley-* are duplicated. Remove them all.
683 (let ((point (point)))
684 (insert-file-contents dgnushack-gnus-load-file)
686 (while (search-forward "smiley-" nil t)
688 (if (looking-at "(autoload ")
689 (delete-region (point) (progn (forward-sexp) (point)))
692 (goto-char (point-max))
693 (when (search-backward "\n(provide " nil t)
695 (delete-region (point) (point-max)))
698 \(provide 'gnus-load)
701 ;;; version-control: never
702 ;;; no-byte-compile: t
703 ;;; no-update-autoloads: t
705 ;;; gnus-load.el ends here
707 ;; Workaround the bug in some version of XEmacs.
708 (when (featurep 'xemacs)
712 (goto-char (point-min))
713 (when (and (fboundp 'custom-add-loads)
714 (not (search-forward "\n(autoload 'custom-add-loads " nil t)))
715 (search-forward "\n;;; Code:" nil t)
717 (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))))
718 (message (format "Compiling %s..." dgnushack-gnus-load-file))
719 (byte-compile-file dgnushack-gnus-load-file))
722 (defun dgnushack-compose-package ()
723 "Re-split the file gnus-load.el into custom-load.el and
724 auto-autoloads.el. It is silly, should be improved!"
726 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...")
727 (let ((customload (expand-file-name "custom-load.el" srcdir))
728 (autoloads (expand-file-name "auto-autoloads.el" srcdir))
731 (insert-file-contents dgnushack-gnus-load-file)
732 (delete-file dgnushack-gnus-load-file)
733 (when (file-exists-p (concat dgnushack-gnus-load-file "c"))
734 (delete-file (concat dgnushack-gnus-load-file "c")))
736 (looking-at "[\t ;]")
740 ;;; custom-load.el --- automatically extracted custom dependencies\n
742 (goto-char (point-max))
745 (not (looking-at "[\t ]*(custom-add-loads[\t\n ]"))))
748 (insert "\n;;; custom-load.el ends here\n")
749 (write-region start (point) customload)
750 (while (looking-at "[\t ]*$")
753 (if (re-search-forward "^[\t\n ]*(if[\t\n ]+(featurep[\t\n ]" nil t)
754 (let ((from (goto-char (match-beginning 0))))
755 (delete-region from (progn
759 (while (looking-at "[\t ;]")
761 (insert "(if (featurep 'gnus-autoloads) (error \"Already loaded\"))\n")
762 (goto-char (point-max))
765 (not (looking-at "[\t ]*(provide[\t\n ]"))))
766 (insert "(provide 'gnus-autoloads)\n")
767 (write-region start (point) autoloads))
768 (byte-compile-file customload)
769 (byte-compile-file autoloads))
771 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...done
775 (defconst dgnushack-info-file-regexp-en
776 (let ((names '("gnus" "message" "emacs-mime"))
778 (while (setq name (pop names))
779 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
780 (when names "\\|"))))
782 "Regexp matching English info files.")
784 (defconst dgnushack-info-file-regexp-ja
785 (let ((names '("gnus-ja" "message-ja"))
787 (while (setq name (pop names))
788 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
789 (when names "\\|"))))
791 "Regexp matching Japanese info files.")
793 (defun dgnushack-remove-extra-files-in-package ()
794 "Remove extra files in the lisp directory of the XEmacs package."
795 (let ((lisp-dir (expand-file-name (concat "lisp/"
797 (cadr command-line-args-left)
800 (car command-line-args-left))))
801 (when (file-directory-p lisp-dir)
803 (dolist (file dgnushack-exporting-files)
804 (setq files (nconc files (list file (concat file "c")))))
805 (dolist (file (directory-files lisp-dir nil nil t t))
806 (unless (member file files)
807 (setq file (expand-file-name file lisp-dir))
808 (message "Removing %s..." file)
813 (defun dgnushack-install-package-manifest ()
814 "Install MANIFEST file as an XEmacs package."
815 (let* ((package-dir (car command-line-args-left))
816 (product-name (cadr command-line-args-left))
817 (name (expand-file-name (concat "pkginfo/MANIFEST." product-name)
820 (message "Generating %s..." name)
822 (insert "pkginfo/MANIFEST." product-name "\n")
823 (let ((lisp-dir (concat "lisp/" product-name "/"))
824 (files (sort (directory-files "." nil "\\.elc?$" t) 'string-lessp))
826 (while (setq file (pop files))
827 (unless (member file dgnushack-unexporting-files)
828 (insert lisp-dir file "\n")))
830 (sort (directory-files "../texi/" nil
831 (concat dgnushack-info-file-regexp-en
833 dgnushack-info-file-regexp-ja)
836 (while (setq file (pop files))
837 (insert "info/" file "\n"))))))
840 (define-compiler-macro describe-key-briefly (&whole form key &optional insert)
841 (if (condition-case nil
843 (describe-key-briefly '((())) nil)
845 (wrong-number-of-arguments nil);; Old Emacsen.
850 (insert (funcall 'describe-key-briefly ,key))
851 (funcall 'describe-key-briefly ,key))
852 `(funcall 'describe-key-briefly ,key))))
854 ;;; dgnushack.el ends here