emacs-devel
[Top][All Lists]
Advanced

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

eval-when-compile help?


From: Dmitry Gutov
Subject: eval-when-compile help?
Date: Tue, 5 Oct 2021 06:01:43 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hi all,

I need to add a piece of code to xref.el which will make it load eieio and define a class xref-location when [possibly byte-compiled and] loaded in Emacs 27 or older.

But preferably avoid loading EIEIO in Emacs 28+. Both at runtime when xref.el is loaded, and when it's compiled too.

The current patch is below. Am I overdoing it with 'eval-and-compile'?

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 1feb6ef915..c9334cfa04 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -74,6 +74,13 @@
 (require 'ring)
 (require 'project)

+(when (version< emacs-version "28")
+  (eval-and-compile
+    (require 'eieio)
+
+    (defclass xref-location () ()
+ :documentation "(Obsolete) location represents a position in a file or buffer.")))
+
 (defgroup xref nil "Cross-referencing commands."
   :version "25.1"
   :group 'tools)



reply via email to

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