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, 2003
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 (if (memq 'coding-category-sjis coding-category-list)
43 (append (delq 'coding-category-sjis
44 (copy-sequence coding-category-list))
45 '(coding-category-sjis))))))
47 (defalias 'facep 'ignore)
52 ;; `dolist' might not be available because of ``-no-autoloads''.
54 ;; It may have been defined in egg.el.
56 (load "cl-macs" nil t))
58 (defvar srcdir (or (getenv "srcdir") "."))
60 (defvar dgnushack-w3-directory (let ((w3dir (getenv "W3DIR")))
61 (unless (zerop (length w3dir))
62 (file-name-as-directory w3dir))))
64 (let ((urldir (getenv "URLDIR")))
65 (unless (zerop (length urldir))
66 (setq urldir (file-name-as-directory urldir))
67 (push (file-name-as-directory urldir) load-path))
68 (when (and dgnushack-w3-directory
69 (not (string-equal urldir dgnushack-w3-directory)))
70 (push dgnushack-w3-directory load-path)))
72 ;; If we are building w3 in a different directory than the source
73 ;; directory, we must read *.el from source directory and write *.elc
74 ;; into the building directory. For that, we define this function
75 ;; before loading bytecomp. Bytecomp doesn't overwrite this function.
76 (defun byte-compile-dest-file (filename)
77 "Convert an Emacs Lisp source file name to a compiled file name.
78 In addition, remove directory name part from FILENAME."
79 (setq filename (byte-compiler-base-file-name filename))
80 (setq filename (file-name-sans-versions filename))
81 (setq filename (file-name-nondirectory filename))
82 (if (memq system-type '(win32 w32 mswindows windows-nt))
83 (setq filename (downcase filename)))
84 (cond ((eq system-type 'vax-vms)
85 (concat (substring filename 0 (string-match ";" filename)) "c"))
86 ((string-match emacs-lisp-file-regexp filename)
87 (concat (substring filename 0 (match-beginning 0)) ".elc"))
88 (t (concat filename ".elc"))))
91 ;; To avoid having defsubsts and inlines happen.
92 ;(if (featurep 'xemacs)
93 ; (require 'byte-optimize)
94 ; (require 'byte-opt))
95 ;(defun byte-optimize-inline-handler (form)
96 ; "byte-optimize-handler for the `inline' special-form."
97 ; (cons 'progn (cdr form)))
98 ;(defalias 'byte-compile-file-form-defsubst 'byte-compile-file-form-defun)
100 (when (and (not (featurep 'xemacs))
101 (= emacs-major-version 21)
102 (= emacs-minor-version 3)
104 (let ((byte-compile-error-on-warn t))
105 (byte-optimize-form (quote (pop x)) t)
107 (error (string-match "called for effect"
108 (error-message-string code)))))
109 (defadvice byte-optimize-form-code-walker (around silence-warn-for-pop
112 "Silence the warning \"...called for effect\" for the `pop' form.
113 It is effective only when the `pop' macro is defined by cl.el rather
116 (if (and (eq (car-safe form) 'car)
118 (setq tmp (get 'car 'side-effect-free))
119 (not byte-compile-delete-errors)
120 (not (eq tmp 'error-free))
121 (eq (car-safe (cadr form)) 'prog1)
122 (let ((var (cadr (cadr form)))
123 (last (nth 2 (cadr form))))
125 (null (nthcdr 3 (cadr form)))
126 (eq (car-safe last) 'setq)
128 (eq (car-safe (nth 2 last)) 'cdr)
129 (eq (cadr (nth 2 last)) var))))
131 (put 'car 'side-effect-free 'error-free)
134 (put 'car 'side-effect-free tmp)))
137 (setq max-specpdl-size 3000)
144 (message "The subform `(< 0 1)' should be optimized to t"))
147 (defadvice byte-optimize-form-code-walker
148 (around fix-bug-in-and/or-forms (form for-effect) activate)
149 "Fix a bug in the optimizing and/or forms.
150 It has already been fixed in XEmacs since 1999-12-06."
151 (if (and for-effect (memq (car-safe form) '(and or)))
152 (let ((fn (car form))
153 (backwards (reverse (cdr form))))
154 (while (and backwards
155 (null (setcar backwards
156 (byte-optimize-form (car backwards) t))))
157 (setq backwards (cdr backwards)))
158 (if (and (cdr form) (null backwards))
160 " all subforms of %s called for effect; deleted" form))
163 (mapcar 'byte-optimize-form (cdr backwards))))
164 (setq ad-return-value (cons fn (nreverse backwards))))
169 (wrong-number-of-arguments
170 ;; Optimize byte code for `char-after'.
171 (put 'char-after 'byte-optimizer 'byte-optimize-char-after)
172 (defun byte-optimize-char-after (form)
173 (if (null (cdr form))
174 '(char-after (point))
179 (wrong-number-of-arguments
180 ;; Optimize byte code for `char-before'.
181 (put 'char-before 'byte-optimizer 'byte-optimize-char-before)
182 (defun byte-optimize-char-before (form)
183 (if (null (cdr form))
184 '(char-before (point))
187 ;; Add `early-package-load-path' to `load-path' for XEmacs. Those paths
188 ;; won't appear in `load-path' when XEmacs starts with the `-no-autoloads'
189 ;; option because of a bug. :<
190 (when (and (featurep 'xemacs)
191 (string-match "--package-path=\\([^ ]+\\)"
192 system-configuration-options))
197 (when (file-directory-p
198 (setq path (expand-file-name "lisp" path)))
199 (directory-files path t)))
200 (split-string (match-string 1 system-configuration-options)
204 (setq path (car paths)
207 (not (or (string-match "/\\.\\.?\\'" path)
208 (member (file-name-as-directory path) load-path)
209 (member path load-path)))
210 (file-directory-p path))
211 (push (file-name-as-directory path) adds)))
212 (setq load-path (nconc (nreverse adds) load-path))))
214 (if (file-exists-p (expand-file-name "dgnuspath.el" srcdir))
215 (load (expand-file-name "dgnuspath.el" srcdir) nil nil t)
216 (message " ** There's no dgnuspath.el file"))
219 (load "~/.lpath.el" t nil t)
220 (error (message "Error in \"~/.lpath.el\" file: %s" err)))
222 ;; Don't load path-util until `char-after' and `char-before' have been
223 ;; optimized because it requires `poe' and then modify the functions.
225 ;; If the APEL modules are installed under the non-standard directory,
226 ;; for example "/var/home/john/lisp/apel-VERSION/", you should add that
227 ;; name using the configure option "--with-addpath=".
228 ;; And also the directory where the EMU modules are installed, for
229 ;; example "/usr/local/share/mule/19.34/site-lisp/", it should be
230 ;; included in the standard `load-path' or added by the configure
231 ;; option "--with-addpath=".
232 (let ((path (or (locate-library "path-util")
233 (locate-library "apel/path-util")));; backward compat.
237 (when (string-match "/$" (setq path (file-name-directory path)))
238 (setq path (substring path 0 (match-beginning 0))))
239 ;; path == "/var/home/john/lisp/apel-VERSION"
240 (when (string-match "/$" (setq parent (file-name-directory path)))
241 (setq parent (substring path 0 (match-beginning 0))))
242 ;; parent == "/var/home/john/lisp"
243 (if (setq lpath (or (member path load-path)
244 (member (file-name-as-directory path) load-path)))
245 (unless (or (member parent load-path)
246 (member (file-name-as-directory parent) load-path))
247 (push parent (cdr lpath)))
248 (push path load-path)
249 (unless (or (member parent load-path)
250 (member (file-name-as-directory parent) load-path))
251 (push parent (cdr load-path))))
253 (require 'path-util))
255 APEL modules are not found in %s.
256 Try to re-configure with --with-addpath=APEL_PATH and run make again.
260 (unless (locate-library "mel")
262 (unless (module-installed-p 'mel)
263 ;; FLIM 1.14 may have installed in two "flim" subdirectories.
264 (push (expand-file-name "flim"
265 (file-name-directory (get-latest-path "^apel$" t)))
267 (unless (module-installed-p 'mel)
269 FLIM modules does not found in %s.
270 Try to re-configure with --with-addpath=FLIM_PATH and run make again.
275 (push srcdir load-path)
276 (load (expand-file-name "lpath.el" srcdir) nil t t)
280 ;; Bind functions defined by `defun-maybe'.
281 (put 'defun-maybe 'byte-hunk-handler 'byte-compile-file-form-defun-maybe)
282 (defun byte-compile-file-form-defun-maybe (form)
283 (if (and (not (fboundp (nth 1 form)))
284 (memq 'unresolved byte-compile-warnings))
285 (setq byte-compile-function-environment
286 (cons (cons (nth 1 form)
287 (cons 'lambda (cdr (cdr form))))
288 byte-compile-function-environment)))
292 :symbol-for-testing-whether-colon-keyword-is-available-or-not
294 (defun dgnushack-bind-colon-keywords ()
295 "Bind all the colon keywords for old Emacsen."
296 (let ((cache (expand-file-name "dgnuskwds.el" srcdir))
297 (makefile (expand-file-name "Makefile" srcdir))
298 (buffer (get-buffer-create " *colon keywords*"))
299 keywords ignores files file dirs dir form elem make-backup-files)
302 (let (buffer-file-format
304 insert-file-contents-post-hook
305 insert-file-contents-pre-hook
306 jam-zcat-filename-list
307 jka-compr-compression-info-list)
308 (if (and (file-exists-p cache)
309 (file-exists-p makefile)
310 (file-newer-than-file-p cache makefile))
312 (insert-file-contents cache nil nil nil t)
313 (setq keywords (read buffer)))
316 '(:symbol-for-testing-whether-colon-keyword-is-available-or-not
317 ;; The following keywords will be bound by CUSTOM.
318 :get :group :initialize :link :load :options :prefix
319 :require :set :tag :type)
320 files (list (locate-library "semi-def")
321 (locate-library "mailcap")
322 (locate-library "mime-def")
323 (locate-library "path-util")
324 (locate-library "poem"))
325 dirs (list (file-name-as-directory (expand-file-name srcdir))))
327 (when (setq file (pop files))
328 (setq dir (file-name-directory file))
329 (unless (member dir dirs)
331 (message "Searching for all the colon keywords in:")
333 (setq dir (pop dirs))
334 (message " %s..." dir)
335 (setq files (directory-files dir t
336 "\\.el\\(\\.gz\\|\\.bz2\\)?$"))
338 (setq file (pop files))
339 (if (string-match "\\(\\.gz$\\)\\|\\.bz2$" file)
340 (let ((temp (expand-file-name "dgnustemp.el" srcdir)))
342 (let ((coding-system-for-read 'binary)
343 (coding-system-for-write 'binary)
344 (default-process-coding-system
347 (insert-file-contents file nil nil nil t)
351 (if (match-beginning 1)
353 (point-min) (point-max)
354 "gzip" t buffer nil "-cd")
356 (point-min) (point-max)
357 "bzip2" t buffer nil "-d"))
361 (message "In file %s: %s" file code)
363 (write-region (point-min) (point-max) temp
367 (insert-file-contents temp nil nil nil t)
368 (delete-file temp))))
369 (insert-file-contents file nil nil nil t))
370 (while (setq form (condition-case nil
375 (setq elem (car-safe form)
376 form (cdr-safe form))
377 (unless (memq (car-safe elem)
378 '(defcustom defface defgroup
379 define-widget quote))
381 (push (car elem) form)
382 (setq elem (cdr elem)))
386 (eq ?: (aref (symbol-name elem) 0))
387 (not (memq elem ignores))
388 (not (memq elem keywords)))
389 (push elem keywords))))))))
390 (setq keywords (sort keywords
392 (string-lessp (symbol-name a)
395 (insert (format "%s" keywords))
396 (write-region (point-min) (point) cache nil 'silent)
398 "The following colon keywords will be bound at run-time:\n %s"
401 (defconst dgnushack-colon-keywords keywords)
403 (set (car keywords) (car keywords))
404 (setq keywords (cdr keywords)))))
405 (byte-compile 'dgnushack-bind-colon-keywords)
406 (dgnushack-bind-colon-keywords)))
408 ;; Unknown variables and functions.
409 (unless (featurep 'xemacs)
410 (defalias 'Custom-make-dependencies 'ignore)
411 (defalias 'update-autoloads-from-directory 'ignore))
413 (defalias 'device-sound-enabled-p 'ignore)
414 (defalias 'play-sound-file 'ignore)
415 (defalias 'nndb-request-article 'ignore)
416 (defalias 'efs-re-read-dir 'ignore)
417 (defalias 'ange-ftp-re-read-dir 'ignore)
418 (defalias 'define-mail-user-agent 'ignore)
421 (when (featurep 'xemacs)
422 (unless (fboundp 'defadvice)
423 (autoload 'defadvice "advice" nil nil 'macro))
424 (autoload 'Info-directory "info" nil t)
425 (autoload 'Info-menu "info" nil t)
426 (autoload 'annotations-at "annotations")
427 (autoload 'apropos "apropos" nil t)
428 (autoload 'apropos-command "apropos" nil t)
429 (autoload 'bbdb-complete-name "bbdb-com" nil t)
430 (autoload 'browse-url "browse-url" nil t)
431 (autoload 'customize-apropos "cus-edit" nil t)
432 (autoload 'customize-save-variable "cus-edit" nil t)
433 (autoload 'customize-variable "cus-edit" nil t)
434 (autoload 'delete-annotation "annotations")
435 (autoload 'dolist "cl-macs" nil nil 'macro)
436 (autoload 'enriched-decode "enriched")
437 (autoload 'executable-find "executable")
438 (autoload 'font-lock-fontify-buffer "font-lock" nil t)
439 (autoload 'info "info" nil t)
440 (autoload 'make-annotation "annotations")
441 (autoload 'make-display-table "disp-table")
443 (autoload 'ps-despool "ps-print" nil t)
444 (autoload 'ps-spool-buffer "ps-print" nil t)
445 (autoload 'ps-spool-buffer-with-faces "ps-print" nil t)
446 (autoload 'read-passwd "passwd")
447 (autoload 'regexp-opt "regexp-opt")
448 (autoload 'reporter-submit-bug-report "reporter")
449 (if (emacs-version>= 21 5)
450 (autoload 'setenv "process" nil t)
451 (autoload 'setenv "env" nil t))
452 (autoload 'smtpmail-send-it "smtpmail")
453 (autoload 'sort-numeric-fields "sort" nil t)
454 (autoload 'sort-subr "sort")
455 (autoload 'trace-function-background "trace" nil t)
456 (autoload 'w3-do-setup "w3")
457 (autoload 'w3-prepare-buffer "w3-display")
458 (autoload 'w3-region "w3-display" nil t)
459 (defalias 'frame-char-height 'frame-height)
460 (defalias 'frame-char-width 'frame-width)
461 (defalias 'frame-parameter 'frame-property)
462 (defalias 'make-overlay 'ignore)
463 (defalias 'overlay-end 'ignore)
464 (defalias 'overlay-get 'ignore)
465 (defalias 'overlay-put 'ignore)
466 (defalias 'overlay-start 'ignore)
467 (defalias 'overlays-in 'ignore)
468 (defalias 'replace-dehighlight 'ignore)
469 (defalias 'replace-highlight 'ignore)
470 (defalias 'run-with-idle-timer 'ignore)
471 (defalias 'w3-coding-system-for-mime-charset 'ignore)))
475 (when (featurep 'xemacs)
476 (autoload 'c-mode "cc-mode" nil t)
477 (autoload 'font-lock-mode "font-lock" nil t)
478 (autoload 'read-kbd-macro "edmacro" nil t)
479 (autoload 'turn-on-font-lock "font-lock" nil t))
480 (autoload 'nnheader-detect-coding-region "nnheader")
481 (autoload 'std11-extract-addresses-components "nnheader")
482 (autoload 'std11-fold-region "nnheader")
483 (autoload 'std11-narrow-to-field "nnheader")
484 (autoload 'std11-unfold-region "nnheader"))
486 (defconst dgnushack-unexporting-files
487 (append '("dgnushack.el" "dgnuspath.el" "dgnuskwds.el" "lpath.el")
488 (unless (or (condition-case code
491 (message "No w3: %s%s, retrying..."
492 (error-message-string code)
493 (if (setq code (locate-library "w3-parse"))
494 (concat " (" code ")")
497 ;; Maybe mis-configured Makefile is used (e.g.
498 ;; configured for FSFmacs but XEmacs is running).
499 (let ((lp (delete dgnushack-w3-directory
500 (copy-sequence load-path))))
501 (if (let ((load-path lp))
505 ;; If success, fix `load-path' for compiling.
508 (message " => fixed; W3DIR=%s"
510 (locate-library "w3-parse")))
512 (message " => ignored")
514 '("nnultimate.el" "webmail.el" "nnwfm.el"))
516 (progn (require 'mh-e) nil)
518 (message "No mh-e: %s%s (ignored)"
519 (error-message-string code)
520 (if (setq code (locate-library "mh-e"))
521 (concat " (" code ")")
525 (progn (require 'xml) nil)
527 (message "No xml: %s%s (ignored)"
528 (error-message-string code)
529 (if (setq code (locate-library "xml"))
530 (concat " (" code ")")
534 (progn (require 'bbdb) nil)
536 (message "No bbdb: %s%s (ignored)"
537 (error-message-string code)
538 (if (setq code (locate-library "bbdb"))
539 (concat " (" code ")")
542 (unless (featurep 'xemacs)
543 '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el"
545 (when (and (fboundp 'base64-decode-string)
546 (subrp (symbol-function 'base64-decode-string)))
548 (when (and (fboundp 'md5) (subrp (symbol-function 'md5)))
550 (when (featurep 'xemacs)
552 "Files which will not be installed.")
554 (defconst dgnushack-exporting-files
555 (let ((files (directory-files srcdir nil "^[^=].*\\.el$" t)))
556 (dolist (file dgnushack-unexporting-files)
557 (setq files (delete file files)))
558 (sort files 'string-lessp))
559 "Files which will be compiled and installed.")
561 (defun dgnushack-exporting-files ()
562 "Print name of files which will be installed."
563 (princ (mapconcat 'identity dgnushack-exporting-files " ")))
565 (defconst dgnushack-dont-compile-files
567 "mm-bodies.el" "mm-decode.el" "mm-encode.el" "mm-extern.el"
568 "mm-partial.el" "mm-url.el" "mm-uu.el" "mm-view.el" "mml-sec.el"
569 "mml-smime.el" "mml.el" "mml1991.el" "mml2015.el")
570 "Files which should not be byte-compiled.")
572 (defun dgnushack-compile-verbosely ()
573 "Call dgnushack-compile with warnings ENABLED. If you are compiling
574 patches to gnus, you should consider modifying make.bat to call
575 dgnushack-compile-verbosely. All other users should continue to use
577 (dgnushack-compile t))
579 (defun dgnushack-compile (&optional warn)
580 ;;(setq byte-compile-dynamic t)
582 (setq byte-compile-warnings
583 '(free-vars unresolved callargs redefine)))
584 (unless (locate-library "cus-edit")
585 (error "You do not seem to have Custom installed.
586 Fetch it from <URL:http://www.dina.kvl.dk/~abraham/custom/>.
587 You also then need to add the following to the lisp/dgnushack.el file:
589 (push \"~/lisp/custom\" load-path)
591 Modify to suit your needs."))
594 (message "load-path=(\"%s\")"
595 (mapconcat 'identity load-path "\"\n \""))
597 (dolist (file dgnushack-exporting-files)
598 (setq file (expand-file-name file srcdir))
599 (when (and (file-exists-p
600 (setq elc (concat (file-name-nondirectory file) "c")))
601 (file-newer-than-file-p file elc))
604 ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
606 (when (featurep 'xemacs)
607 (setq gnus-xmas-glyph-directory "dummy"))
609 (let ((files dgnushack-exporting-files)
610 ;;(byte-compile-generate-call-tree t)
612 (while (setq file (pop files))
613 (unless (member file dgnushack-dont-compile-files)
614 (setq file (expand-file-name file srcdir))
615 (when (or (not (file-exists-p
616 (setq elc (concat (file-name-nondirectory file) "c"))))
617 (file-newer-than-file-p file elc))
619 (byte-compile-file file)))))))
621 (defun dgnushack-recompile ()
623 (byte-recompile-directory "." 0))
625 (defvar dgnushack-gnus-load-file
626 (if (featurep 'xemacs)
627 (expand-file-name "auto-autoloads.el" srcdir)
628 (expand-file-name "gnus-load.el" srcdir)))
630 (defvar dgnushack-cus-load-file
631 (if (featurep 'xemacs)
632 (expand-file-name "custom-load.el" srcdir)
633 (expand-file-name "cus-load.el" srcdir)))
635 (defun dgnushack-make-cus-load ()
637 (let ((cusload-base-file dgnushack-cus-load-file))
638 (if (fboundp 'custom-make-dependencies)
639 (custom-make-dependencies)
640 (Custom-make-dependencies))
641 (when (featurep 'xemacs)
642 (message "Compiling %s..." dgnushack-cus-load-file)
643 (byte-compile-file dgnushack-cus-load-file))))
645 (defun dgnushack-make-auto-load ()
647 (unless (make-autoload '(define-derived-mode child parent name
650 (defadvice make-autoload (around handle-define-derived-mode activate)
651 "Handle `define-derived-mode'."
652 (if (eq (car-safe (ad-get-arg 0)) 'define-derived-mode)
653 (setq ad-return-value
655 (list 'quote (nth 1 (ad-get-arg 0)))
657 (nth 4 (ad-get-arg 0))
660 (put 'define-derived-mode 'doc-string-elt 3))
661 (let ((generated-autoload-file dgnushack-gnus-load-file)
662 (make-backup-files nil)
663 (autoload-package-name "gnus"))
664 (if (featurep 'xemacs)
665 (if (file-exists-p generated-autoload-file)
666 (delete-file generated-autoload-file))
667 (with-temp-file generated-autoload-file
669 (if (featurep 'xemacs)
670 (let ((si:message (symbol-function 'message)))
671 (defun message (fmt &rest args)
672 (cond ((and (string-equal "Generating autoloads for %s..." fmt)
673 (file-exists-p (file-name-nondirectory (car args))))
675 fmt (file-name-nondirectory (car args))))
676 ((string-equal "No autoloads found in %s" fmt))
677 ((string-equal "Generating autoloads for %s...done" fmt))
678 (t (apply si:message fmt args))))
680 (batch-update-autoloads)
681 (fset 'message si:message)))
682 (batch-update-autoloads))))
684 (defun dgnushack-make-load ()
685 (unless (featurep 'xemacs)
686 (message "Generating %s..." dgnushack-gnus-load-file)
687 (with-temp-file dgnushack-gnus-load-file
688 (insert-file-contents dgnushack-cus-load-file)
689 (delete-file dgnushack-cus-load-file)
690 (goto-char (point-min))
691 (search-forward ";;; Code:")
693 (delete-region (point-min) (point))
695 ;;; gnus-load.el --- automatically extracted custom dependencies and autoload
699 (goto-char (point-max))
700 (if (search-backward "custom-versions-load-alist" nil t)
703 (while (eq (char-after) ?\;)
706 (delete-region (point) (point-max))
708 ;; smiley-* are duplicated. Remove them all.
709 (let ((point (point)))
710 (insert-file-contents dgnushack-gnus-load-file)
712 (while (search-forward "smiley-" nil t)
714 (if (looking-at "(autoload ")
715 (delete-region (point) (progn (forward-sexp) (point)))
718 (goto-char (point-max))
719 (when (search-backward "\n(provide " nil t)
721 (delete-region (point) (point-max)))
724 \(provide 'gnus-load)
727 ;;; version-control: never
728 ;;; no-byte-compile: t
729 ;;; no-update-autoloads: t
731 ;;; gnus-load.el ends here
734 (message "Compiling %s..." dgnushack-gnus-load-file)
735 (byte-compile-file dgnushack-gnus-load-file)
736 (when (featurep 'xemacs)
737 (message "Creating dummy gnus-load.el...")
738 (with-temp-file (expand-file-name "gnus-load.el")
741 \(provide 'gnus-load)
744 ;;; version-control: never
745 ;;; no-byte-compile: t
746 ;;; no-update-autoloads: t
748 ;;; gnus-load.el ends here"))))
751 (defconst dgnushack-info-file-regexp-en
752 (let ((names '("gnus" "message" "emacs-mime"))
754 (while (setq name (pop names))
755 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
756 (when names "\\|"))))
758 "Regexp matching English info files.")
760 (defconst dgnushack-info-file-regexp-ja
761 (let ((names '("gnus-ja" "message-ja"))
763 (while (setq name (pop names))
764 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
765 (when names "\\|"))))
767 "Regexp matching Japanese info files.")
769 (defun dgnushack-remove-extra-files-in-package ()
770 "Remove extra files in the lisp directory of the XEmacs package."
771 (let ((lisp-dir (expand-file-name (concat "lisp/"
773 (cadr command-line-args-left)
776 (car command-line-args-left))))
777 (setq command-line-args-left nil)
778 (when (file-directory-p lisp-dir)
780 (dolist (file dgnushack-exporting-files)
781 (setq files (nconc files (list file (concat file "c")))))
782 (dolist (file (directory-files lisp-dir nil nil t t))
783 (unless (member file files)
784 (setq file (expand-file-name file lisp-dir))
785 (message "Removing %s..." file)
790 (defun dgnushack-install-package-manifest ()
791 "Install MANIFEST file as an XEmacs package."
792 (let* ((package-dir (pop command-line-args-left))
793 (product-name (pop command-line-args-left))
794 (pkginfo-dir (expand-file-name "pkginfo" package-dir))
795 (name (expand-file-name (concat "MANIFEST." product-name)
798 (unless (file-directory-p pkginfo-dir)
799 (message "Creating directory %s/..." pkginfo-dir)
800 (make-directory pkginfo-dir))
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