A couple of problems with new packages

Aidan Kehoe kehoea at parhasard.net
Sun Dec 2 18:23:24 EST 2007


 Ar an dara lá de mí na Nollaig, scríobh Vin Shelton: 

 > On Dec 2, 2007 3:29 PM, Aidan Kehoe <kehoea at parhasard.net> wrote:
 >
 > > That's coming from my change of
 > > http://mid.gmane.org/18252.39139.149087.844153@parhasard.net ; the 21.5 byte
 > > compiler adds a :default keyword to custom-declare-variable calls when it
 > > byte compiles the init value. This allows the custom UI code to present
 > > non-byte-compiled Lisp for editing. I don't know of a way to avoid the error
 > > entirely.
 > >
 > > The error should be limited to the specific case of 21.4 loading code
 > > compiled by 21.5 where the code has complex VALUE clauses in defcustom
 > > calls.
 > >
 > > Vin, would you consider adding the very last hunk of that patch to 21.4?
 > 
 > Yes, I'll consider it, but whether or not I apply it, we must solve
 > the problem for users of XEmacs <= 21.4.21.  Please make a suggestion
 > so that packages built with 21.5 will work with existing 21.4
 > installs.

With a bit of further thought, the below occurs to me, which is entirely
compatible and very ugly. Is running packages built with 21.5 on 21.4 a
supported use case? What happens if we modify 21.5’s byte codes?

lisp/ChangeLog addition:

2007-12-03  Aidan Kehoe  <kehoea at parhasard.net>

	* bytecomp.el (byte-compile-file-form-custom-declare-variable):
	Instead of using a keyword argument that's incompatible with 21.4,
	modify the byte compiled init code to change the variable's
	standard-value property itself. 


XEmacs Trunk source patch:
Diff command:   cvs -q diff -Nu
Files affected: lisp/bytecomp.el
===================================================================
RCS

Index: lisp/bytecomp.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/bytecomp.el,v
retrieving revision 1.22
diff -u -u -r1.22 bytecomp.el
--- lisp/bytecomp.el	2007/12/01 13:40:07	1.22
+++ lisp/bytecomp.el	2007/12/02 23:19:18
@@ -2405,10 +2405,17 @@
        ;; And save a value to be examined in the custom UI, if that differs
        ;; from the init value.
        (unless (equal to-examine (car-safe (cdr (third form))))
-         (setf (nthcdr 4 form) (nconc
-                                (list :default 
-                                      (list 'quote to-examine))
-                                (nthcdr 4 form)))))
+         (setcdr (third form)
+                 (list (byte-compile-top-level 
+                        ;; This is ugly. custom-declare-variable errors if
+                        ;; it's passed a keyword it doesn't know about, and
+                        ;; so to make this code run on 21.4, we add code to
+                        ;; modify the standard-value property to the
+                        ;; byte-compiled value for DEFAULT.
+                        `(prog2 (put ,(second form) 'standard-value
+                                     '(,to-examine))
+                          ,to-examine)
+                        nil 'file)))))
     form))
 
 ;;;###autoload

-- 
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?



More information about the XEmacs-Beta mailing list