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: Re: eval-when-compile help? Date: Tue, 5 Oct 2021 17:16:58 +0300 Message-ID: <7972b0e8-6cfe-e53f-f102-039729210cb3@yandex.ru> References: <8e532f35-729d-ed5a-c4f4-85e2d011c8eb@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7597"; 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 Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 05 16:18:26 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 1mXlH0-0001l3-6O for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Oct 2021 16:18:26 +0200 Original-Received: from localhost ([::1]:35960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXlGy-0001i8-MS for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Oct 2021 10:18:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXlFn-0000xq-9y for emacs-devel@gnu.org; Tue, 05 Oct 2021 10:17:11 -0400 Original-Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:40869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXlFl-0001w6-J1 for emacs-devel@gnu.org; Tue, 05 Oct 2021 10:17:11 -0400 Original-Received: by mail-lf1-x12b.google.com with SMTP id y15so21161056lfk.7 for ; Tue, 05 Oct 2021 07:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uX4lyGb02VrHahM4Z1sDBLKOPcrtiLYobSo1xateMRc=; b=gKYviBC10P2GL/D8XUdJx5rzkOPjaJa0ZFL3g+jP22BTGcIgLZXB3rjuoxbJyBp/9h Z0xspjCLVr0Bjhwn5J6fsh0Pg+37snyy3OR5SGIDB/xdqN5JB/qDe6HFH1DVXO8ZMfQj 7NH2GEovkLE2u+rhnmKYx7/AQkuX6Gpp66gCvLsZfySgpPpK3ZLI9k6bmsP+Yi/yuDNK QsPubTBpkmfOE30YFMfkPkBLMyk5rvtI51SrlNDy71Yali0NSiKklOmcPBLxxik7KlvG uPz2ysXcm1Y36JU/6RUqikU5ZcQoxB5h1ZAOlpO4VvwvhuGsNpyGBHY31f9AFHWexpu4 /Z1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uX4lyGb02VrHahM4Z1sDBLKOPcrtiLYobSo1xateMRc=; b=ex/qSLIv2uWMEJV4eeNtIFnxIAOR5qrizsmMHaGp997lYwdp/UOYGPLPMdul7puJZT 0iEwvFKJabPSF+HFZsdZ8cNAN7E3bPi8Yq0ncmDUdEggpjp+3mbliVawyF9oznI0uHen rZZiWNE8MwAemdM0IPHg2xEWqF5Twh8Ydusbtf5WBaVEdoi1HDkbQgCnMJlAt/PxGKLx sm+aU8kUpX9wSp9p/YHKxBUmqXhSqkZd2Fl7Ezasd7b+LB0QY9xrdF3ucvnX7t9GW3pM JOIRnWy10fBAQ4PNYQVxztUBpYQlBfr5zjbgA6Zry+iuntVd3Km4rTXk76gSK3oeJSNK k6Ag== X-Gm-Message-State: AOAM5320CTun8MvDaCQgnhUek5lVUx1hGb9YSkr3fEreniV9DPhKjvAh fpQ3tQacQQ++Pqf9ho3Zye8XE5kHBjI= X-Google-Smtp-Source: ABdhPJwld/uJOgrSRnsh17MjQvUDR91SA5iU7uCn5Y52VsHyDBqSwkYQHB8QswD39/BQGdJz5VhP4w== X-Received: by 2002:a05:6512:13a9:: with SMTP id p41mr3802282lfa.648.1633443419902; Tue, 05 Oct 2021 07:16:59 -0700 (PDT) Original-Received: from [192.168.1.113] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id s25sm1910814ljc.100.2021.10.05.07.16.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Oct 2021 07:16:59 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=raaahh@gmail.com; helo=mail-lf1-x12b.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, NICE_REPLY_A=-0.001, 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:276333 Archived-At: On 05.10.2021 15:19, Stefan Monnier wrote: >> +(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. In my testing, this doesn't make `eieio` loaded in Emacs 28 at runtime. Though I suppose it gets loaded during byte-compilation. Moving `eval-and-compile` to the top level makes a lot of sense, but now I get the compilation warnings back (when compiling in Emacs 28). So I suppose this is the final form: (eval-and-compile (when (version< emacs-version "28") (require 'eieio) (with-no-warnings (defclass xref-location () () :documentation "(Obsolete) location represents a position in a file or buffer."))))