unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* eval-when-compile help?
@ 2021-10-05  3:01 Dmitry Gutov
  2021-10-05 12:19 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2021-10-05  3:01 UTC (permalink / raw)
  To: emacs-devel

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)



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-05 19:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-05  3:01 eval-when-compile help? Dmitry Gutov
2021-10-05 12:19 ` Stefan Monnier
2021-10-05 14:16   ` Dmitry Gutov
2021-10-05 15:05     ` Stefan Monnier
2021-10-05 16:22       ` Dmitry Gutov
2021-10-05 19:53         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).