* lisp/dgnushack.el (dgnushack-compose-package): New function.
authoryamaoka <yamaoka>
Mon, 12 Mar 2001 13:15:40 +0000 (13:15 +0000)
committeryamaoka <yamaoka>
Mon, 12 Mar 2001 13:15:40 +0000 (13:15 +0000)
(dgnushack-make-load): Add autoload for cus-load if it is missing.

* lisp/Makefile.in (compose-package): Use `dgnushack-compose-package'.
(clean, clever): Remove custom-load.el.

* Makefile.in (elclean): Remove custom-load.el.

ChangeLog
Makefile.in
lisp/Makefile.in
lisp/dgnushack.el

index 3d25fb8..f78bce4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-03-12  Katsumi Yamaoka <yamaoka@jpl.org>
+
+       * lisp/dgnushack.el (dgnushack-compose-package): New function.
+       (dgnushack-make-load): Add autoload for cus-load if it is missing.
+
+       * lisp/Makefile.in (compose-package): Use
+       `dgnushack-compose-package'.
+       (clean, clever): Remove custom-load.el.
+
+       * Makefile.in (elclean): Remove custom-load.el.
+
 2001-03-08  Katsumi Yamaoka <yamaoka@jpl.org>
 
        * lisp/gnus-art.el (gnus-article-prepare-display): Setup MIME
index 7fdbdfd..9a70c03 100644 (file)
@@ -163,7 +163,7 @@ clean:
        for i in lisp texi; do (cd $$i; $(MAKE) clean); done
 
 elclean:
-       cd lisp && rm -f *.elc auto-autoloads.el gnus-load.el
+       cd lisp && rm -f *.elc auto-autoloads.el custom-load.el gnus-load.el
 
 x:
        $(MAKE) EMACS="$(XEMACS)"
index c631548..b3d796a 100644 (file)
@@ -43,8 +43,8 @@ clever some: gnus-load.elc
          fi; \
          if test $$RM_ELC = t; then \
            echo " => maybe yes;" \
-               "rm -f *.elc auto-autoloads.el"; \
-           rm -f *.elc auto-autoloads.el; \
+               "rm -f *.elc auto-autoloads.el custom-load.el"; \
+           rm -f *.elc auto-autoloads.el custom-load.el; \
          else \
            echo " => maybe unnecessary"; \
          fi; \
@@ -70,8 +70,7 @@ install-package-manifest:
                $(PACKAGEDIR) $(GNUS_PRODUCT_NAME)
 
 compose-package: gnus-load.elc
-       mv gnus-load.el auto-autoloads.el; \
-       mv gnus-load.elc auto-autoloads.elc
+       $(EMACS_COMP) -f dgnushack-compose-package
 
 remove-extra-files-in-package:
        $(EMACS_COMP) -f dgnushack-remove-extra-files-in-package \
@@ -101,7 +100,8 @@ gnus-load.elc:
        $(EMACS_COMP) -f dgnushack-make-load
 
 clean:
-       rm -f *.orig *.rej *.elc *~ auto-autoloads.el gnus-load.el
+       rm -f *.orig *.rej *.elc *~ \
+               auto-autoloads.el custom-load.el gnus-load.el
 
 distclean: clean
        rm -f Makefile dgnuspath.el
index 7afd1d3..1bbf4fd 100644 (file)
@@ -412,6 +412,10 @@ Modify to suit your needs."))
          (search-forward ";;; Code:")
          (forward-line)
          (delete-region (point-min) (point))
+         (unless (re-search-forward
+                  "^[\t ]*(autoload[\t\n ]+\\('\\|(quote[\t\n ]+\\)custom-add-loads[\t\n ]" nil t)
+           (insert "\n(autoload 'custom-add-loads \"cus-load\")\n")
+           (goto-char (point-min)))
          (insert "\
 ;;; gnus-load.el --- automatically extracted custom dependencies and autoload
 ;;
@@ -459,6 +463,58 @@ Modify to suit your needs."))
   (byte-compile-file dgnushack-gnus-load-file))
 
 \f
+(defun dgnushack-compose-package ()
+  "Re-split the file gnus-load.el into custom-load.el and
+auto-autoloads.el.  It is silly, should be improved!"
+  (message "\
+Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...")
+  (let ((customload (expand-file-name "custom-load.el" srcdir))
+       (autoloads (expand-file-name "auto-autoloads.el" srcdir)))
+    (with-temp-buffer
+      (insert-file-contents dgnushack-gnus-load-file)
+      (delete-file dgnushack-gnus-load-file)
+      (when (file-exists-p (concat dgnushack-gnus-load-file "c"))
+       (delete-file (concat dgnushack-gnus-load-file "c")))
+      (while (prog1
+                (looking-at "[\t ;]")
+              (forward-line 1)))
+      (delete-region (point-min) (point))
+      (insert "\
+;;; custom-load.el --- automatically extracted custom dependencies\n
+;;; Code:\n\n")
+      (goto-char (point-max))
+      (while (progn
+              (forward-line -1)
+              (not (looking-at "[\t ]*(custom-add-loads[\t\n ]"))))
+      (forward-list 1)
+      (forward-line 1)
+      (insert "\n;;; custom-load.el ends here\n")
+      (write-region (point-min) (point) customload)
+      (while (looking-at "[\t ]*$")
+       (forward-line 1))
+      (delete-region (point-min) (point))
+      (if (re-search-forward "^[\t\n ]*(if[\t\n ]+(featurep[\t\n ]" nil t)
+         (let ((from (goto-char (match-beginning 0))))
+           (delete-region from (progn
+                                 (forward-list 1)
+                                 (forward-line 1)
+                                 (point))))
+       (while (looking-at "[\t ;]")
+         (forward-line 1)))
+      (insert "(if (featurep 'gnus-autoloads) (error \"Already loaded\"))\n")
+      (goto-char (point-max))
+      (while (progn
+              (forward-line -1)
+              (not (looking-at "[\t ]*(provide[\t\n ]"))))
+      (delete-region (point) (point-max))
+      (insert "(provide 'gnus-autoloads)\n")
+      (write-region (point-min) (point) autoloads))
+    (byte-compile-file customload)
+    (byte-compile-file autoloads))
+  (message "\
+Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...done"))
+
+\f
 (defconst dgnushack-info-file-regexp-en
   (let ((names '("gnus" "message" "emacs-mime"))
        regexp name)