emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Emacs 22 compatibility


From: Achim Gratz
Subject: Re: [O] Emacs 22 compatibility
Date: Wed, 19 Dec 2012 19:54:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (gnu/linux)

Bastien writes:
> If you or anyone can fix those error, please have a go.

Here is another one that may need further work.  The byte-compiler of
Emacs 22 does not seem to handle defaliased special forms correctly when
expanding macros.  This can be circumvented with a defmacro, but then
the decision becomes compile-time rather than load time (one could make
it run-time by quoteing more broadly).  For the current uses this should
be OK.  Also, ODT export now compiles correctly, but still doesn't work
in Emacs 22 since delete-directory doesn't have a second argument
(recursive delete) in Emacs 22.  This would need to be worked around or
at least the error caught.

>From e459dde441932d95d157648519fc2768262fd1e8 Mon Sep 17 00:00:00 2001
From: Achim Gratz <address@hidden>
Date: Wed, 19 Dec 2012 19:35:19 +0100
Subject: [PATCH] Backwards compatibility: don't defalias special forms

* lisp/org-compat.el (org-condition-case-unless-debug): Do not use
  defalias for special forms, the Emacs 22 byte-compiler does not
  recognize them correctly when compiling macros.  Use a macro instead
  and rely on macro expansion.  That however makes the decision at
  compile time, which should be acceptable in this case since it only
  affects debugging.
---
 lisp/org-compat.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 1f330b1..292a777 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -438,12 +438,13 @@ (defun org-pop-to-buffer-same-window
 
 ;; `condition-case-unless-debug' has been introduced in Emacs 24.1
 ;; `condition-case-no-debug' has been introduced in Emacs 23.1
-(defalias 'org-condition-case-unless-debug
+(defmacro org-condition-case-unless-debug (var bodyform &rest handlers)
+  (declare (debug condition-case) (indent 2))
   (or (and (fboundp 'condition-case-unless-debug)
-          'condition-case-unless-debug)
+          `(condition-case-unless-debug ,var ,bodyform ,@handlers))
       (and (fboundp 'condition-case-no-debug)
-          'condition-case-no-debug)
-      'condition-case))
+          `(condition-case-no-debug ,var ,bodyform ,@handlers))
+      `(condition-case ,var ,bodyform ,@handlers)))
 
 ;;;###autoload
 (defmacro org-check-version ()
-- 
1.8.0.1

With all fixes in, Emacs 24 can run the tests for an the Org compiled by
Emacs 22 now with just one error remaining, on master this is:

Test ob-exp/mixed-blocks-with-exports-both condition:
    (wrong-type-argument number-or-marker-p nil)
   FAILED   19/403  ob-exp/mixed-blocks-with-exports-both

and this one on maint:

Test test-org-src/blank-line-block condition:
    (error "No special environment to edit here")
   FAILED  346/378  test-org-src/blank-line-block

One of the 13 errors when Emacs 22 runs the testsuite itself is due to
an unconditional use of visual-line-mode, which Emacs 22 does not have.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

reply via email to

[Prev in Thread] Current Thread [Next in Thread]