emacs-pretest-bug
[Top][All Lists]
Advanced

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

RE: byte compiler warnings for different Emacs versions


From: Drew Adams
Subject: RE: byte compiler warnings for different Emacs versions
Date: Fri, 12 Nov 2004 10:29:07 -0800

FYI, this is what I decided to do: put the Emacs-21-specific code inside
(eval (quote...)), so it just gets passed along uncompiled to the .elc file.
(I don't know if there is another, recommended way to do this.)

Why?

1. The call to `define-minor-mode' doesn't really need to be byte-compiled.
It is short and cheap to interpret.

2. The code defining macro `define-minor-mode' is large, and there is no
guarantee that it will be usable with the Emacs 20 byte-compiler anyway, so
I don't see adding the macro definition for Emacs 20 as a reasonable
solution here.

3. I want to use `define-minor-mode' for the Emacs 21 version, because that
way my code is only slightly different from the standard Emacs 21 code for
delsel.el. Similarly, I want to keep the Emacs 20 version only slightly
different from the standard Emacs 20 code for delsel.el.

4. The point was to have a single compiled file that works with both Emacs
versions. Both byte-compilers (20 & 21) produce code that works with both
(in this case).

Here's the code skeleton, to make things clearer:

(if (fboundp 'define-minor-mode) ; runtime test, not compile-time
    (eval '(define-minor-mode    ; Emacs 21 version
            delete-selection-mode...))
  (defun delete-selection-mode...)) ; Emacs 20 version

Thanks,

 - Drew


-----Original Message-----From: Stefan Monnier
> Anyway, this is the case that I was discussing from the beginning: I would
> like a _runtime_ (top-level) test in compiled code that will make the
right
> function definition based on the runtime Emacs major version.

I'd recommend either you don't use define-minor-mode, or if you do, use
it unconditionally and provide your own definition of it if the Emacs
you're running on doesn't have it.





reply via email to

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