RECOMMEND packages
This patch monkey-patches some versions of XEmacs so that they can
handle recently added defun-like constructs in auto-autoloads
generation. It is needed to address building the recent packages tree
by existing 21.4 versions of XEmacs as well as 21.5 versions <=
21.5.28.
It does not attempt to address the bad sequencing of ede and eieio in
semantic's REQUIRES Make variable that has been causing consternation
the last few days.
If 21.4 is updated as Mike proposes, then this facility is only needed
for legacy XEmacsen. It is only invoked for packages which set the
PACKAGE_FUTURE variable in their Makefiles.
This facility was tested with XEmacs 21.4.20 on JDE, which built
successfully.
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/ChangeLog,v
retrieving revision 1.727
diff -u -U0 -r1.727 ChangeLog
--- ChangeLog 2008/02/27 22:51:32 1.727
+++ ChangeLog 2008/02/27 22:58:46
@@ -0,0 +3,7 @@
+2008-02-27 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * package-future.el: New file.
+
+ * XEmacs.rules: Document PACKAGE_FUTURE.
+ (auto-autoloads.el): Use it.
+
Index: package-future.el
===================================================================
RCS file: package-future.el
diff -N package-future.el
--- /dev/null Wed Feb 27 23:56:42 2008
+++ package-future.el Wed Feb 27 23:58:48 2008
@@ -0,0 +1,124 @@
+;;; package-future.el --- update XEmacs to deal with modern packages
+
+;; Copyright (C) 2007 Free Software Foundation, Inc.
+
+;; Author: Stephen J. Turnbull <stephen(a)xemacs.org>
+;; Maintainer: XEmacs Development Team
+;; Keywords: packages
+
+;; This file is part of the XEmacs package distribution.
+
+;; The XEmacs packages are free software; you can redistribute it and/or
+;; modify them under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; The XEmacs packages are distributed in the hope that they will be
+;; useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+;; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with the XEmacs packages; see the file COPYING. If not, write
+;; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file contains monkey-patches required to provide functionality
+;; missing in older XEmacsen but needed to build some recent packages.
+
+;; To use it, add
+;;
+;; PACKAGE_FUTURE = -l ../..package-future.el
+;;
+;; to a package's XEmacs Makefile.
+
+;; To add features to this file, ... well, be a wizard, then do wizardly
+;; things. Remember that a True Wizard avoids disturbing the Equilibrium
+;; needlessly. Carefully protect the pristine XEmacs from unneeded
+;; monkey-patches! Try to use exact tests.
+
+;;; Code:
+
+(unless (emacs-version>= 21 5 29)
+ ;; We monkeypatch the make-autoload function so it can handle recent
+ ;; packages like JDE that require extension of the class of functions
+ ;; that must generate autoloads.
+ (terpri)
+ (princ "***** WARNING: monkey-patching `make-autoload'. *****")
+ (terpri)
+ (require 'autoload)
+ (unless (boundp 'autoload-make-autoload-operators)
+ (defvar autoload-make-autoload-operators
+ '(defun define-skeleton defmacro define-derived-mode define-generic-mode
+ easy-mmode-define-minor-mode easy-mmode-define-global-mode
+ define-minor-mode defun* defmacro*)
+ "defun-like operators that use `autoload' to load the library."))
+ (fmakunbound 'make-autoload)
+ (defun make-autoload (form file)
+ "Turn FORM into an autoload or defvar for source file FILE.
+Returns nil if FORM is not a special autoload form (i.e. a function definition
+or macro definition or a defcustom)."
+ (let ((car (car-safe form)) expand)
+ (cond
+ ;; For complex cases, try again on the macro-expansion.
+ ((and (memq car '(easy-mmode-define-global-mode
+ easy-mmode-define-minor-mode define-minor-mode))
+ (setq expand (let ((load-file-name file)) (macroexpand form)))
+ (eq (car expand) 'progn)
+ (memq :autoload-end expand))
+ (let ((end (memq :autoload-end expand)))
+ ;; Cut-off anything after the :autoload-end marker.
+ (setcdr end nil)
+ (cons 'progn
+ (mapcar (lambda (form) (make-autoload form file))
+ (cdr expand)))))
+
+ ;; For special function-like operators, use the `autoload' function.
+ ((memq car autoload-make-autoload-operators)
+ (let* ((macrop (memq car '(defmacro defmacro*)))
+ (name (nth 1 form))
+ (body (nthcdr (get car 'doc-string-elt) form))
+ (doc (if (stringp (car body)) (pop body))))
+ ;; `define-generic-mode' quotes the name, so take care of that
+ (list 'autoload (if (listp name) name (list 'quote name)) file doc
+ (or (and (memq car '(define-skeleton define-derived-mode
+ define-generic-mode
+ easy-mmode-define-global-mode
+ easy-mmode-define-minor-mode
+ define-minor-mode)) t)
+ (eq (car-safe (car body)) 'interactive))
+ (if macrop (list 'quote 'macro) nil))))
+
+ ;; Convert defcustom to a simpler (and less space-consuming) defvar,
+ ;; but add some extra stuff if it uses :require.
+ ((eq car 'defcustom)
+ (let ((varname (car-safe (cdr-safe form)))
+ (init (car-safe (cdr-safe (cdr-safe form))))
+ (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form)))))
+ (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form))))))
+ (if (not (plist-get rest :require))
+ `(defvar ,varname ,init ,doc)
+ `(progn
+ (defvar ,varname ,init ,doc)
+ (custom-add-to-group ,(plist-get rest :group)
+ ',varname 'custom-variable)
+ (custom-add-load ',varname
+ ,(plist-get rest :require))))))
+ ;; Coding systems. #### Would be nice to handle the docstring here too.
+ ((memq car '(make-coding-system make-8-bit-coding-system))
+ `(autoload-coding-system ,(nth 1 form) '(load ,file)))
+ ;; nil here indicates that this is not a special autoload form.
+ (t nil)))))
+
+;;; end monkey-patches for pre-21.5.29
+
+;;; monkey-patches to provide autoloads for EIEIO object definitions
+
+(add-to-list 'autoload-make-autoload-operators 'defclass)
+(add-to-list 'autoload-make-autoload-operators 'defmethod)
+
+;;; end monkey-patches for EIEIO
+
+;;; package-future.el ends here
Index: XEmacs.rules
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/XEmacs.rules,v
retrieving revision 1.60
diff -u -r1.60 XEmacs.rules
--- XEmacs.rules 2008/02/27 22:51:31 1.60
+++ XEmacs.rules 2008/02/27 22:58:48
@@ -66,6 +66,9 @@
# PRELOADS = additional command-line arguments needed when compiling .elcs
# AUTOLOAD_PATH = subdirectory in source tree where .elcs are located (this
# is where auto-autoloads.el, etc. will be placed)
+# PACKAGE_FUTURE = -l ../../package-future.el (this file monkey-patches the
+# running xemacs with features required by certain packages that are not
+# available in older XEmacsen).
#
# Doc files (see below):
# ----------------------
@@ -489,7 +492,7 @@
$(XEMACS_BATCH_CLEAN) $(LOAD_AUTOLOADS) \
-eval "$(AUTOLOAD_PACKAGE_NAME)" \
-eval "$(AUTOLOAD_FILE)" \
- -l autoload -f batch-update-autoloads $^
+ -l autoload $(PACKAGE_FUTURE) -f batch-update-autoloads $^
@touch $(AUTOLOAD_PATH)/auto-autoloads.el
@rm -f $(AUTOLOAD_PATH)/auto-autoloads.el~
endif
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches