From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.cc-mode.general,gmane.emacs.devel Subject: Re: Last use of defadvice in Emacs Date: Fri, 8 Apr 2022 18:06:32 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34450"; mail-complaints-to="usenet@ciao.gmane.io" Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: cc-mode-help-bounces@lists.sourceforge.net Fri Apr 08 20:06:58 2022 Return-path: Envelope-to: sf-cc-mode-help@m.gmane-mx.org Original-Received: from lists.sourceforge.net ([216.105.38.7]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nct0b-0008mb-4a for sf-cc-mode-help@m.gmane-mx.org; Fri, 08 Apr 2022 20:06:57 +0200 Original-Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nct0U-00026k-Nu; Fri, 08 Apr 2022 18:06:49 +0000 Original-Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nct0T-00026e-IQ for cc-mode-help@lists.sourceforge.net; Fri, 08 Apr 2022 18:06:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=From:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=EfK+nRI5VCU2uzpZjwXAEx+22AmDRj+Z2Lnd9UWcPIY=; b=Mw7n/5mw+2DYveUHUie3dMcCER QCTJWKSX3TgPx3SvKwvqQ9iAWZpgycVGpEyh0fQlDD05P5wOFtcBGKMCpHIf7dtkfXqF6/r2Jy2+/ Es7D6olY76UYlBNxbnc1Tyh5McGu68jw3cbjbvZO6n8ezOckkfhUAWu9vebFl5rsiIWw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=EfK+nRI5VCU2uzpZjwXAEx+22AmDRj+Z2Lnd9UWcPIY=; b=akR6I1vDB4wjwUDASiZrbur86y SQqgDh8g01+Du3ImXs9/jf9K4OXMAl0KKEyGmtp/Jworc2ZUf1M6Bb02RlPcsSJYkoypF0URvBzI3 pBbHB3yWytfv1Bm1fDQoMvpRrPjwhmLXl79zKh1VkjcebROpZT6Wc8O1v+C+2nqpY/FQ=; Original-Received: from eggs.gnu.org ([209.51.188.92]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1nct0R-009zxT-GE for cc-mode-help@lists.sourceforge.net; Fri, 08 Apr 2022 18:06:48 +0000 Original-Received: from colin.muc.de ([193.149.48.1]:19064 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1nct0F-0007OA-Sq for bug-cc-mode@gnu.org; Fri, 08 Apr 2022 14:06:37 -0400 Original-Received: (qmail 16477 invoked by uid 3782); 8 Apr 2022 18:06:33 -0000 Original-Received: from acm.muc.de (p4fe159b9.dip0.t-ipconnect.de [79.225.89.185]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 08 Apr 2022 20:06:32 +0200 Original-Received: (qmail 8122 invoked by uid 1000); 8 Apr 2022 18:06:32 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Headers-End: 1nct0R-009zxT-GE X-BeenThere: cc-mode-help@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Bug reports, feature requests, and general talk about CC Mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cc-mode-help-bounces@lists.sourceforge.net Xref: news.gmane.io gmane.emacs.cc-mode.general:8304 gmane.emacs.devel:287978 Archived-At: Hello, Stefan. On Fri, Apr 08, 2022 at 13:39:58 -0400, Stefan Monnier wrote: > >> (defmacro url-http-ntlm--if-when-compile (cond &rest body) > >> (declare (debug t) (indent 1)) > >> (when (eval cond) > >> `(progn ,@body))) > >> ;; Remove authorization after redirect. > >> (url-http-ntlm--if-when-compile > >> (and (boundp 'emacs-major-version) > >> (< emacs-major-version 25)) > >> ... > >> ... Various code, including, incidentally, a `defadvice` ... > >> ...) > > Here, a piece of `byte-code' gets compiled for the > > url-http-ntlm--if-when-compile call. This is useless code without any > > useful function. (I've just tried it.) > That bytecode implements your #if feature. So if we care about that > feature, we'd remove the `url-http-ntlm--` prefix and move it to > lisp/subr.el, indeed. Apologies, you are right. That piece of byte code is indeed part of the macro's definition, not something generated by it. I tried compiling a source file with just (require ...) (defun foo ...) (url-http-ntlm--if-when-compile ..) and (defun bar ...), and in the ..elc, the foo and the bar had nothing intervening between them. > I agree that Emacs does not come with the equivalent of #if but the > above macro shows that it can be implemented quite easily if we care to > provide it. Yes. :-) [ .... ] > Stefan -- Alan Mackenzie (Nuremberg, Germany).