emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* (Emacs 23/24 binary compatibility): defstruct, setf
@ 2013-09-03  8:42 Jambunathan K
  2013-09-03 19:06 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Jambunathan K @ 2013-09-03  8:42 UTC (permalink / raw)
  To: emacs-devel; +Cc: emacs-orgmode, Nicolas Goaziou


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\a!\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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (Emacs 23/24 binary compatibility): defstruct, setf
  2013-09-03  8:42 (Emacs 23/24 binary compatibility): defstruct, setf Jambunathan K
@ 2013-09-03 19:06 ` Stefan Monnier
  2013-09-03 21:14   ` Jambunathan K
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-09-03 19:06 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Nicolas Goaziou, emacs-orgmode, emacs-devel

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (Emacs 23/24 binary compatibility): defstruct, setf
  2013-09-03 19:06 ` Stefan Monnier
@ 2013-09-03 21:14   ` Jambunathan K
  2013-09-04  2:57     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Jambunathan K @ 2013-09-03 21:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-orgmode, Nicolas Goaziou, emacs-devel

Stefan Monnier <monnier@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (Emacs 23/24 binary compatibility): defstruct, setf
  2013-09-03 21:14   ` Jambunathan K
@ 2013-09-04  2:57     ` Stefan Monnier
  2013-09-04  4:01       ` Jambunathan K
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-09-04  2:57 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Nicolas Goaziou, emacs-orgmode, emacs-devel

>>> 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 +0000
+++ lisp/emacs-lisp/gv.el	2013-09-04 02:56:26 +0000
@@ -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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (Emacs 23/24 binary compatibility): defstruct, setf
  2013-09-04  2:57     ` Stefan Monnier
@ 2013-09-04  4:01       ` Jambunathan K
  2013-09-04 20:04         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Jambunathan K @ 2013-09-04  4:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-orgmode, Nicolas Goaziou, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> More specifically, the setf and the defstruct need to be compiled with
> "the same version" (either both cl.el, or both gv.el).
>
> Does the patch below work for you?

Yes.  Please install.

FWIW, I see following errors reported.


On load of *.el file:
====================


Loading /home/kjambunathan/src/org-mode/contrib/lisp/ox-jabref.el
(source)...

Eager macro-expansion failure: (error "Incompatible place expression
needs recompilation: (org-export-backend-transcoders enhanced-backend)")

gv-get: Incompatible place expression needs recompilation:
(org-export-backend-transcoders enhanced-backend)


On compile of *.el file:
========================

Compiling file /home/kjambunathan/src/org-mode/contrib/lisp/ox-jabref.el
at Wed Sep 4 09:22:25 2013

ox-jabref.el:170:1:Error: Incompatible place expression needs
recompilation: (org-export-backend-transcoders enhanced-backend)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (Emacs 23/24 binary compatibility): defstruct, setf
  2013-09-04  4:01       ` Jambunathan K
@ 2013-09-04 20:04         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-09-04 20:04 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode, Nicolas Goaziou, emacs-devel

>> Does the patch below work for you?
> Yes.  Please install.

Done,


        Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-04 20:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-03  8:42 (Emacs 23/24 binary compatibility): defstruct, setf Jambunathan K
2013-09-03 19:06 ` Stefan Monnier
2013-09-03 21:14   ` Jambunathan K
2013-09-04  2:57     ` Stefan Monnier
2013-09-04  4:01       ` Jambunathan K
2013-09-04 20:04         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).