1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
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..." code
469 (locate-library "w3-parse"))
471 ;; Maybe mis-configured Makefile is used (e.g.
472 ;; configured for FSFmacs but XEmacs is running).
473 (let ((lp (delete dgnushack-w3-directory
474 (copy-sequence load-path))))
475 (if (let ((load-path lp))
479 ;; If success, fix `load-path' for compiling.
482 (message " => fixed; W3DIR=%s"
484 (locate-library "w3-parse")))
486 (message " => ignored")
488 '("nnultimate.el" "webmail.el" "nnwfm.el"))
490 (progn (require 'mh-e) nil)
492 (message "No mh-e: %s %s (ignored)" code (locate-library "mh-e"))
495 (progn (require 'xml) nil)
497 (message "No xml: %s %s (ignored)" code (locate-library "xml"))
500 (progn (require 'bbdb) nil)
502 (message "No bbdb: %s %s (ignored)" code (locate-library "bbdb"))
504 (unless (featurep 'xemacs)
505 '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el"))
506 (when (and (not (featurep 'xemacs))
507 (<= emacs-major-version 20))
509 (when (and (fboundp 'base64-decode-string)
510 (subrp (symbol-function 'base64-decode-string)))
512 (when (and (fboundp 'md5) (subrp (symbol-function 'md5)))
514 (unless (boundp 'MULE)
516 "Files which will not be installed.")
518 (defconst dgnushack-exporting-files
519 (let ((files (directory-files srcdir nil "^[^=].*\\.el$" t)))
520 (dolist (file dgnushack-unexporting-files)
521 (setq files (delete file files)))
522 (sort files 'string-lessp))
523 "Files which will be compiled and installed.")
525 (defun dgnushack-exporting-files ()
526 "Print name of files which will be installed."
527 (princ (mapconcat 'identity dgnushack-exporting-files " ")))
529 (defun dgnushack-compile (&optional warn)
530 ;;(setq byte-compile-dynamic t)
532 (setq byte-compile-warnings
533 '(free-vars unresolved callargs redefine)))
534 (unless (locate-library "cus-edit")
535 (error "You do not seem to have Custom installed.
536 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
537 You also then need to add the following to the lisp/dgnushack.el file:
539 (push \"~/lisp/custom\" load-path)
541 Modify to suit your needs."))
544 (message "load-path=(\"%s\")"
545 (mapconcat 'identity load-path "\"\n \""))
547 (dolist (file dgnushack-exporting-files)
548 (setq file (expand-file-name file srcdir))
549 (when (and (file-exists-p
550 (setq elc (concat (file-name-nondirectory file) "c")))
551 (file-newer-than-file-p file elc))
554 (let ((files dgnushack-exporting-files)
555 ;;(byte-compile-generate-call-tree t)
557 ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
559 (when (featurep 'xemacs)
560 (setq gnus-xmas-glyph-directory "dummy"))
561 (while (setq file (pop files))
562 (setq file (expand-file-name file srcdir))
563 (when (or (not (file-exists-p
564 (setq elc (concat (file-name-nondirectory file) "c"))))
565 (file-newer-than-file-p file elc))
567 (byte-compile-file file))))))
569 (defun dgnushack-recompile ()
571 (byte-recompile-directory "." 0))
573 (defvar dgnushack-gnus-load-file (expand-file-name "gnus-load.el" srcdir))
574 (defvar dgnushack-cus-load-file (expand-file-name "cus-load.el" srcdir))
575 (defvar dgnushack-auto-load-file (expand-file-name "auto-autoloads.el" srcdir))
577 (defun dgnushack-make-cus-load ()
578 (when (condition-case nil
581 (let ((cusload-base-file dgnushack-cus-load-file))
582 (if (fboundp 'custom-make-dependencies)
583 (custom-make-dependencies)
584 (Custom-make-dependencies)))))
586 (defun dgnushack-make-auto-load ()
588 (unless (make-autoload '(define-derived-mode child parent name
591 (defadvice make-autoload (around handle-define-derived-mode activate)
592 "Handle `define-derived-mode'."
593 (if (eq (car-safe (ad-get-arg 0)) 'define-derived-mode)
594 (setq ad-return-value
596 (list 'quote (nth 1 (ad-get-arg 0)))
598 (nth 4 (ad-get-arg 0))
601 (put 'define-derived-mode 'doc-string-elt 3))
602 (let ((generated-autoload-file dgnushack-gnus-load-file)
603 (make-backup-files nil)
604 (autoload-package-name "gnus"))
605 (if (featurep 'xemacs)
607 (if (file-exists-p generated-autoload-file)
608 (delete-file generated-autoload-file))
609 (if (file-exists-p dgnushack-auto-load-file)
610 (delete-file dgnushack-auto-load-file)))
611 (with-temp-file generated-autoload-file
613 (if (featurep 'xemacs)
614 (let ((si:message (symbol-function 'message)))
615 (defun message (fmt &rest args)
616 (cond ((and (string-equal "Generating autoloads for %s..." fmt)
617 (file-exists-p (file-name-nondirectory (car args))))
619 fmt (file-name-nondirectory (car args))))
620 ((string-equal "No autoloads found in %s" fmt))
621 ((string-equal "Generating autoloads for %s...done" fmt))
622 (t (apply si:message fmt args))))
624 (batch-update-autoloads)
625 (fset 'message si:message)))
626 (batch-update-autoloads))))
628 (defun dgnushack-make-load ()
629 (message (format "Generating %s..." dgnushack-gnus-load-file))
630 (with-temp-file dgnushack-gnus-load-file
631 (if (file-exists-p dgnushack-cus-load-file)
633 (insert-file-contents dgnushack-cus-load-file)
634 (delete-file dgnushack-cus-load-file)
635 (goto-char (point-min))
636 (search-forward ";;; Code:")
638 (delete-region (point-min) (point))
639 (unless (re-search-forward "\
640 ^[\t ]*(autoload[\t\n ]+\\('\\|(quote[\t\n ]+\\)custom-add-loads[\t\n ]"
642 (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))
643 (goto-char (point-min))
645 ;;; gnus-load.el --- automatically extracted custom dependencies and autoload
649 (goto-char (point-max))
650 (if (search-backward "custom-versions-load-alist" nil t)
653 (while (eq (char-after) ?\;)
656 (delete-region (point) (point-max))
659 ;;; gnus-load.el --- automatically extracted autoload
663 ;; smiley-* are duplicated. Remove them all.
664 (let ((point (point)))
665 (insert-file-contents dgnushack-gnus-load-file)
667 (while (search-forward "smiley-" nil t)
669 (if (looking-at "(autoload ")
670 (delete-region (point) (progn (forward-sexp) (point)))
673 (goto-char (point-max))
674 (when (search-backward "\n(provide " nil t)
676 (delete-region (point) (point-max)))
679 \(provide 'gnus-load)
682 ;;; version-control: never
683 ;;; no-byte-compile: t
684 ;;; no-update-autoloads: t
686 ;;; gnus-load.el ends here
688 ;; Workaround the bug in some version of XEmacs.
689 (when (featurep 'xemacs)
693 (goto-char (point-min))
694 (when (and (fboundp 'custom-add-loads)
695 (not (search-forward "\n(autoload 'custom-add-loads " nil t)))
696 (search-forward "\n;;; Code:" nil t)
698 (insert "\n(autoload 'custom-add-loads \"cus-load\")\n"))))
699 (message (format "Compiling %s..." dgnushack-gnus-load-file))
700 (byte-compile-file dgnushack-gnus-load-file))
703 (defun dgnushack-compose-package ()
704 "Re-split the file gnus-load.el into custom-load.el and
705 auto-autoloads.el. It is silly, should be improved!"
707 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...")
708 (let ((customload (expand-file-name "custom-load.el" srcdir))
709 (autoloads (expand-file-name "auto-autoloads.el" srcdir))
712 (insert-file-contents dgnushack-gnus-load-file)
713 (delete-file dgnushack-gnus-load-file)
714 (when (file-exists-p (concat dgnushack-gnus-load-file "c"))
715 (delete-file (concat dgnushack-gnus-load-file "c")))
717 (looking-at "[\t ;]")
721 ;;; custom-load.el --- automatically extracted custom dependencies\n
723 (goto-char (point-max))
726 (not (looking-at "[\t ]*(custom-add-loads[\t\n ]"))))
729 (insert "\n;;; custom-load.el ends here\n")
730 (write-region start (point) customload)
731 (while (looking-at "[\t ]*$")
734 (if (re-search-forward "^[\t\n ]*(if[\t\n ]+(featurep[\t\n ]" nil t)
735 (let ((from (goto-char (match-beginning 0))))
736 (delete-region from (progn
740 (while (looking-at "[\t ;]")
742 (insert "(if (featurep 'gnus-autoloads) (error \"Already loaded\"))\n")
743 (goto-char (point-max))
746 (not (looking-at "[\t ]*(provide[\t\n ]"))))
747 (insert "(provide 'gnus-autoloads)\n")
748 (write-region start (point) autoloads))
749 (byte-compile-file customload)
750 (byte-compile-file autoloads))
752 Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...done
756 (defconst dgnushack-info-file-regexp-en
757 (let ((names '("gnus" "message" "emacs-mime"))
759 (while (setq name (pop names))
760 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
761 (when names "\\|"))))
763 "Regexp matching English info files.")
765 (defconst dgnushack-info-file-regexp-ja
766 (let ((names '("gnus-ja" "message-ja"))
768 (while (setq name (pop names))
769 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
770 (when names "\\|"))))
772 "Regexp matching Japanese info files.")
774 (defun dgnushack-remove-extra-files-in-package ()
775 "Remove extra files in the lisp directory of the XEmacs package."
776 (let ((lisp-dir (expand-file-name (concat "lisp/"
778 (cadr command-line-args-left)
781 (car command-line-args-left))))
782 (when (file-directory-p lisp-dir)
784 (dolist (file dgnushack-exporting-files)
785 (setq files (nconc files (list file (concat file "c")))))
786 (dolist (file (directory-files lisp-dir nil nil t t))
787 (unless (member file files)
788 (setq file (expand-file-name file lisp-dir))
789 (message "Removing %s..." file)
794 (defun dgnushack-install-package-manifest ()
795 "Install MANIFEST file as an XEmacs package."
796 (let* ((package-dir (car command-line-args-left))
797 (product-name (cadr command-line-args-left))
798 (name (expand-file-name (concat "pkginfo/MANIFEST." product-name)
801 (message "Generating %s..." name)
803 (insert "pkginfo/MANIFEST." product-name "\n")
804 (let ((lisp-dir (concat "lisp/" product-name "/"))
805 (files (sort (directory-files "." nil "\\.elc?$" t) 'string-lessp))
807 (while (setq file (pop files))
808 (unless (member file dgnushack-unexporting-files)
809 (insert lisp-dir file "\n")))
811 (sort (directory-files "../texi/" nil
812 (concat dgnushack-info-file-regexp-en
814 dgnushack-info-file-regexp-ja)
817 (while (setq file (pop files))
818 (insert "info/" file "\n"))))))
821 (define-compiler-macro describe-key-briefly (&whole form key &optional insert)
822 (if (condition-case nil
824 (describe-key-briefly '((())) nil)
826 (wrong-number-of-arguments nil);; Old Emacsen.
831 (insert (funcall 'describe-key-briefly ,key))
832 (funcall 'describe-key-briefly ,key))
833 `(funcall 'describe-key-briefly ,key))))
835 ;;; dgnushack.el ends here