[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval-when-compile help?
From: |
Stefan Monnier |
Subject: |
Re: eval-when-compile help? |
Date: |
Tue, 05 Oct 2021 08:19:10 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> +(when (version< emacs-version "28")
> + (eval-and-compile
> + (require 'eieio)
> +
> + (defclass xref-location () ()
> + :documentation "(Obsolete) location represents a position in a file or
> buffer.")))
[...]
> Am I overdoing it with 'eval-and-compile'?
I suspect that "from the outside" you don't need the `eval-and-compile`
at all here. But if you remove it, there's a good chance that
compilation of `defclass` will fail (because the `require` won't be
executed at compile-time).
This said, I'd recommend you hoist the `eval-and-compile` outside of the
`when` so that `eieio` is not loaded in Emacs≥28.
Stefan