Re: [O] (Emacs 23/24 binary compatibility): defstruct, setf

2013-09-05 Thread Jambunathan K
Stefan Monnier monn...@iro.umontreal.ca writes:

 I think existing *.elc files compiled against Emacs-23.2.1 should load
 fine on new Emacs versions.

 It's indeed an incompatibility I introduced when we switched from CL's
 setf to gv.el's setf, because the two work in a very different way.

In simple terms, the problem seems to be a 24.x style `setf' on a 23.x
defstruct.

NEWS has entries on gv.el and setf-s.  I am not sure which of those
entries amount to the above incompatibility.

If we could report on incompatibiliy that would be awesome.  Can the
FIRST EVER setf call make (additional) version checks and report errors.



 Stefan



Re: [O] (Emacs 23/24 binary compatibility): defstruct, setf

2013-09-04 Thread Stefan Monnier
 Does the patch below work for you?
 Yes.  Please install.

Done,


Stefan



[O] (Emacs 23/24 binary compatibility): defstruct, setf

2013-09-03 Thread Jambunathan K

1. Compile ox.el (new-to-be-merged export library) with Emacs 23.2.1
   (stock Debian binary)

2. Load the ox.elc file on Emacs Bzr trunk.

3. setf on a defstruct field breaks as seen below.

Modify (1) so that .elc files are generated against Emacs Bzr trunk.
Note that setf succeeds.



I think existing *.elc files compiled against Emacs-23.2.1 should load
fine on new Emacs versions.




The struct is as below defined in ox.el

(defstruct (org-export-backend
(:constructor org-export-create-backend))
  name parent transcoders options filters blocks menu)


ox-jabref.el is loaded uncompiled.




Debugger entered--Lisp error: (error (org-export-backend-transcoders 
enhanced-backend) is not a valid place expression)
  signal(error ((org-export-backend-transcoders enhanced-backend) is not a 
valid place expression))
  error(%S is not a valid place expression (org-export-backend-transcoders 
enhanced-backend))
  gv-get((org-export-backend-transcoders enhanced-backend) #[514 
\211\300!\207 [enhanced-transcoders] 4 \n\n(fn GETTER SETTER)])
  #[128 
\211\203\211\211AA\262\204\211A\262@@\300\301\302\303\304\305!\306\\307\310%\\207\311\203@\312\211A\262@\211A\262@EB\262\202'\313\237B\207
 [gv-get make-byte-code 514 \211\300!\207 vconcat vector [] 4 \n\n(fn GETTER 
SETTER) nil setf progn] 11 
(/home/kjambunathan/src/emacs/trunk/lisp/emacs-lisp/gv.elc . 
6424)]((org-export-backend-transcoders enhanced-backend) enhanced-transcoders)
  (setf (org-export-backend-transcoders enhanced-backend) enhanced-transcoders)
  (let* ((enhanced-backend (copy-org-export-backend 
org-jabref--stock-odt-backend)) (stock-transcoders 
(org-export-backend-transcoders org-jabref--stock-odt-backend)) 
(enhanced-transcoders (append (quote ((keyword . org-jabref-keyword) 
(citation-reference . org-jabref-odt-citation-reference/text))) 
stock-transcoders))) (setf (org-export-backend-transcoders enhanced-backend) 
enhanced-transcoders) (let ((menu (org-export-backend-menu enhanced-backend))) 
(setf (cadr menu) (concat (cadr menu)  (With Jabref Processing 
(org-export-register-backend enhanced-backend) enhanced-backend)
  (defvar org-jabref--enhanced-odt-backend (let* ((enhanced-backend 
(copy-org-export-backend org-jabref--stock-odt-backend)) (stock-transcoders 
(org-export-backend-transcoders org-jabref--stock-odt-backend)) 
(enhanced-transcoders (append (quote ((keyword . org-jabref-keyword) 
(citation-reference . org-jabref-odt-citation-reference/text))) 
stock-transcoders))) (setf (org-export-backend-transcoders enhanced-backend) 
enhanced-transcoders) (let ((menu (org-export-backend-menu enhanced-backend))) 
(setf (cadr menu) (concat (cadr menu)  (With Jabref Processing 
(org-export-register-backend enhanced-backend) enhanced-backend))
  eval-buffer(#buffer  *load* nil 
/home/kjambunathan/src/org-mode/contrib/lisp/ox-jabref.el nil t)  ; Reading 
at buffer position 6948
  
load-with-code-conversion(/home/kjambunathan/src/org-mode/contrib/lisp/ox-jabref.el
 /home/kjambunathan/src/org-mode/contrib/lisp/ox-jabref.el nil nil)
  load(ox-jabref.el)
  load-library(ox-jabref.el)
  call-interactively(load-library record nil)
  command-execute(load-library record)
  execute-extended-command(nil load-library)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)



Re: [O] (Emacs 23/24 binary compatibility): defstruct, setf

2013-09-03 Thread Stefan Monnier
 I think existing *.elc files compiled against Emacs-23.2.1 should load
 fine on new Emacs versions.

It's indeed an incompatibility I introduced when we switched from CL's
setf to gv.el's setf, because the two work in a very different way.


Stefan



Re: [O] (Emacs 23/24 binary compatibility): defstruct, setf

2013-09-03 Thread Stefan Monnier
 I think existing *.elc files compiled against Emacs-23.2.1 should load
 fine on new Emacs versions.
 It's indeed an incompatibility I introduced when we switched from CL's
 setf to gv.el's setf, because the two work in a very different way.
 In simple terms, the problem seems to be a 24.x style `setf' on a 23.x
 defstruct.

More specifically, the setf and the defstruct need to be compiled with
the same version (either both cl.el, or both gv.el).

 If we could report on incompatibiliy that would be awesome.  Can the
 FIRST EVER setf call make (additional) version checks and report errors.

Does the patch below work for you?


Stefan


=== modified file 'lisp/emacs-lisp/gv.el'
--- lisp/emacs-lisp/gv.el   2013-08-13 02:30:52 +
+++ lisp/emacs-lisp/gv.el   2013-09-04 02:56:26 +
@@ -102,7 +102,11 @@
   ;; Follow aliases.
   (setq me (cons (symbol-function head) (cdr place
   (if (eq me place)
-  (error %S is not a valid place expression place)
+  (error
+   (if (and (symbolp head) (get head 'setf-method))
+   Incompatible place expression needs recompilation: %S
+ %S is not a valid place expression)
+   place)
 (gv-get me do)))
 
 ;;;###autoload