From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ulrich Mueller Newsgroups: gmane.emacs.devel Subject: Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp? Date: Mon, 28 Aug 2023 23:01:53 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30327"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Ulrich Mueller , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 28 23:03:08 2023 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 1qajO7-0007dU-Nj for ged-emacs-devel@m.gmane-mx.org; Mon, 28 Aug 2023 23:03:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qajNE-0005CM-RT; Mon, 28 Aug 2023 17:02:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qajN7-0005Bt-Cu for emacs-devel@gnu.org; Mon, 28 Aug 2023 17:02:06 -0400 Original-Received: from woodpecker.gentoo.org ([140.211.166.183] helo=smtp.gentoo.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1qajN3-0000Cq-Ej for emacs-devel@gnu.org; Mon, 28 Aug 2023 17:02:05 -0400 In-Reply-To: (Alan Mackenzie's message of "Mon, 28 Aug 2023 20:06:27 +0000") Received-SPF: pass client-ip=140.211.166.183; envelope-from=ulm@gentoo.org; helo=smtp.gentoo.org X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:309454 Archived-At: >>>>> On Mon, 28 Aug 2023, Alan Mackenzie wrote: >> > (when (< emacs-major-version 24) >> > (defadvice .....)) >> I believe (eval-when-compile (< emacs-major-version 24)) would work? > I've twisted my head into knots in the past trying to work out how to > use eval-when/and-compile for this purpose. The point is, I don't want > the defadvice to be evaluated at compile time; I just want it to be > compiled (or not). Sorry, I should have been clearer. The full construct would look like this: (when (eval-when-compile (< emacs-major-version 24)) (defadvice .....)) So only the test would be evaluated at compile time, the defadvice itself would be compiled normally (or not, if the test fails).