Paul Kinnucan <[EMAIL PROTECTED]> writes:

> Jeff Greif writes:
> 
>  > The problem appears to be the attempt to support both GNU Emacs and
> Xemacs using runtime conditionals.  It appears that compile-time
> conditionals are needed in order to compile the code in
> tree-widget.el, or some additional runtime conditionals are needed,
> such as
> 
>  > 
>  > if (not (featurep 'xemacs))
>  >   (progn
>  >     (defvar widget-button-keymap nil)
>  >     (defun extent-list () nil)))
>  > 
>  > You can also work around the problem in ways which break Xemacs
> support.
> 
> Hi Jeff,
> 
> Yes, most of the JDE Lisp files include XEmacs comptability code that
> leads to free variable warnings when the files are compiled under
> Emacs or under XEmacs. I don't know of any compile-time method of
> avoiding free variable warnings in the compiler output. Do you?
> 
> 
> - Paul

Yes it's possible.

The conditional forms suggested by Jeff need to be surrounded by
(eval-when-compile...), so the byte compiler sees the dummy
definitions.

I usually do something like the following:

(eval-and-compile
  (defconst my-xemacs-flag (featurep 'xemacs)))

(eval-when-compile
  (cond (my-xemacs-flag
         (defvar gnu-emacs-variable nil)
         (fset 'gnu-emacs-function nil))
        (t ; GNU Emacs
         (defvar xemacs-variable nil)
         (fset 'xemacs-function nil))))

Cheers,
Mike

Reply via email to