Issue89

classification
Title [PATCH] Building packages with 21.4
Type Module
Severity Platform
Keywords
explanation
process
These optional controls are only of interest to committers and tracker administrators.
Status chatting   Reason
Superseder   Submitted 2007-12-22.06:17:33
Priority   Assigned To
Nosy List  

Created on 2008-01-19.04:58:05 by stephen, last changed 2008-01-19.06:43:11 by viteno.

Messages
msg321 [hidden] ([hidden]) Date: 2008-01-19.06:43:11
  Message-ID: <87ejddbqtd.fsf@arafel.viteno.net>
* "Stephen J. Turnbull" <stephen@xemacs.org>:

Hi!

> Michael Sperber writes:
>
>  > I think this is too messy, and too confusing.  I'd rather just factor
>  > out the names of the special operators---just like you did---and add
>  > the more exotic operators to a file in xemacs-base.  We'll have to patch
>  > 21.4 once, but I think that's acceptable.
>
> Norbert has already objected explicitly to the claim that patching
> 21.4 is a solution

That's correct, but if it's too tedious to fix this in the packages only
I go along.  A practical and maintainable solution is a good asset to
have.

On the other hand, in my opinion the patch does not look that messy -
but then I may be biased :-)

_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta@xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta
msg109 [hidden] ([hidden]) Date: 2008-01-19.04:58:05
  Message-ID: <87sl1uwa05.fsf@uwakimon.sk.tsukuba.ac.jp>
Michael Sperber writes:

 > I think this is too messy, and too confusing.  I'd rather just factor
 > out the names of the special operators---just like you did---and add
 > the more exotic operators to a file in xemacs-base.  We'll have to patch
 > 21.4 once, but I think that's acceptable.

I've pushed a patch that does this for 21.5.

_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta@xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta
msg108 [hidden] ([hidden]) Date: 2008-01-19.04:58:05
  Message-ID: <87zlw3w8w2.fsf@uwakimon.sk.tsukuba.ac.jp>
Stephen J. Turnbull writes:

 > It's worth it to people who have an older XEmacs, though.
 > 
 > How about in autoload.el
 > 
 > ;;; Don't add keywords here!  Do it in xemacs-base/therightplace.el
 > (defvar autoload-make-autoload-keywords '(defun ... defmacro))
 > 
 > and in xemacs-base/therightplace.el

Well, I couldn't come up with "therightplace", but I did get a
minimally-invasive build with XEmacs 21.4.  Specifically, there is no
patch to XEmacs 21.4 required.  Basically, I just monkey-patch 21.4 to
use XEmacs 21.5.29's #'make-autoload.  I've made it a little bit
cleaner and more general than that, and if we want to support XEmacs
21.4 much longer in the face of stuff like EIEIO, we're going to need
at least this much generality.

Vin: if you want you can add this patch to 21.4.22; it is easy enough
to make the conditional understand about patched 21.4 versions.

Patch attached.

Whaddya guys think?

Index: package-future.el
===================================================================
RCS file: package-future.el
diff -N package-future.el
--- /dev/null	Sat Dec 22 06:51:34 2007
+++ package-future.el	Sat Dec 22 06:51:36 2007
@@ -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@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.59
diff -u -r1.59 XEmacs.rules
--- XEmacs.rules	2007/05/24 20:22:29	1.59
+++ XEmacs.rules	2007/12/22 05:51:36
@@ -59,6 +59,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):
 # ----------------------
@@ -488,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
Index: xemacs-packages/jde/Makefile
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/jde/Makefile,v
retrieving revision 1.79
diff -u -r1.79 Makefile
--- xemacs-packages/jde/Makefile	2007/11/29 11:33:34	1.79
+++ xemacs-packages/jde/Makefile	2007/12/22 05:51:36
@@ -151,6 +151,8 @@

 AUTOLOAD_PATH = lisp

+PACKAGE_FUTURE = -l ../../package-future.el
+
 PRELOADS = -l jde-compat.el -l jde.el

 include ../../XEmacs.rules

_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta@xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta
History
Date User Action Args
2008-01-19 06:43:11vitenosetmessages: + msg321
2008-01-19 04:58:05stephensetstatus: new -> chatting
messages: + msg109
2008-01-19 04:58:05stephencreate