From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: eval-when-compile help? Date: Tue, 5 Oct 2021 06:01:43 +0300 Message-ID: <8e532f35-729d-ed5a-c4f4-85e2d011c8eb@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23833"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 05 05:02:51 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXajB-00064s-Mh for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Oct 2021 05:02:49 +0200 Original-Received: from localhost ([::1]:60996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXaj9-0003qT-Gc for ged-emacs-devel@m.gmane-mx.org; Mon, 04 Oct 2021 23:02:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXaiE-00039N-AQ for emacs-devel@gnu.org; Mon, 04 Oct 2021 23:01:50 -0400 Original-Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:37529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXaiB-0002Ca-UR for emacs-devel@gnu.org; Mon, 04 Oct 2021 23:01:50 -0400 Original-Received: by mail-lf1-x134.google.com with SMTP id i4so80670618lfv.4 for ; Mon, 04 Oct 2021 20:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=GxQu6NeemmQu0yhnzzONLOTfPcJ7aA/hqLhK3xNBjDs=; b=Z+GOMgfEJe8YqgZcLLnBYAftcnoaXx6w3coSsfvC4OyA2J/cpwyoRoo0bEgWHfigT0 w9zIBSQdRbHcwxNjvbrTsUl0pN+QcFftGoCKwcG+7Qc8mpNe48+xj35Yn6P92+LWKRQ3 ZEfCyDM1VdcFSlHPyEFHFV0x4/JNnhQjiaVWVA3zbC4fDprPvQjuuEG7UHKGcMPCybOx Si4Vn1q2qkjvFRTizH2PV7sR8fGshhHFKOumq4NfVzN/OioIpLgGuOkaECwvGiw5V65G f6+VHNtff2kgPRErQksFICCuh3eHmhPM2beLGelmg/M4zo9buTIRjRvhib8eRXZY+x4z 06gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=GxQu6NeemmQu0yhnzzONLOTfPcJ7aA/hqLhK3xNBjDs=; b=2LSGhmS2s3k8Vm7ZKdU5lizGeB2mVJOqqYNRxNhau16MXCKYBg3wONSRkBp4Po25LW bFzCv8rEVM6HpGgzeX4RXhcsppIf/ZJoBBe+iSjpiLZ5CilJ+1FmD1s/12iEKRvuGlme +ho+G4xSZNrSEbEvWZLdz3GSITDdfS9l6sySCsItiy84tWCf9vkpz9TAo9cYvVHMvopT BAyhDcLSQQhG1+WA4m1pD3rSW8lZ+hVxbjLr5/3whsGwVi7P3qav/1VCauHwXPjsABxw PoPChIDb+TqGLit92u5rsfrbWeqkRw8pjlL7hloUAB/VdjaYMISv1QLrnYvrpErtazLi h3rw== X-Gm-Message-State: AOAM5337cPRv+y4ujtXRaisMfMoEI3opIomr/E+7npK/GzlS8LUQPS2z 3uUvIwnLngK4rHjgKWLaCt8vzcKT4Rw= X-Google-Smtp-Source: ABdhPJxfyJ7umgMCoqEIEUL0U6sVJpQgXM0DGZcGJ3rHqHM19N3p3FfEdviosIUSYYZoSeT94blVdA== X-Received: by 2002:a2e:5750:: with SMTP id r16mr20086195ljd.371.1633402905016; Mon, 04 Oct 2021 20:01:45 -0700 (PDT) Original-Received: from [192.168.1.113] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id z10sm1915068ljc.117.2021.10.04.20.01.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Oct 2021 20:01:44 -0700 (PDT) Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=raaahh@gmail.com; helo=mail-lf1-x134.google.com X-Spam_score_int: 0 X-Spam_score: -0.0 X-Spam_bar: / X-Spam_report: (-0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:276290 Archived-At: 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)