From unknown Thu Aug 14 21:45:06 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#61179 <61179@debbugs.gnu.org> To: bug#61179 <61179@debbugs.gnu.org> Subject: Status: lambda inside interactive form of around advice isn't a closure Reply-To: bug#61179 <61179@debbugs.gnu.org> Date: Fri, 15 Aug 2025 04:45:06 +0000 retitle 61179 lambda inside interactive form of around advice isn't a closu= re reassign 61179 emacs submitter 61179 Jonas Bernoulli severity 61179 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 10:48:25 2023 Received: (at submit) by debbugs.gnu.org; 30 Jan 2023 15:48:25 +0000 Received: from localhost ([127.0.0.1]:50164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMWOP-0007sx-2L for submit@debbugs.gnu.org; Mon, 30 Jan 2023 10:48:25 -0500 Received: from lists.gnu.org ([209.51.188.17]:54932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMWON-0007sp-01 for submit@debbugs.gnu.org; Mon, 30 Jan 2023 10:48:23 -0500 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 1pMWOL-00006Z-8v for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2023 10:48:22 -0500 Received: from mail.hostpark.net ([212.243.197.30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMWOI-0001yh-Cs for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2023 10:48:20 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 0C79316289; Mon, 30 Jan 2023 16:48:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :subject:subject:from:from:received:received; s=sel2011a; t= 1675093693; bh=elwky+mahFoOs3l5U4UJoUSJg+rp6gry4Vew9cUN1lw=; b=Q htDM4Pw/O+cFqsV5Lj0m6ySayxlAkxOVw143r41E7OK1NU2VQZmWOZbIYySN8N5F LzLRLxoa9BfhiPmqbf9mYL3gulFrQUWwtQ+0zVfy9shQlABI022pFMwTjMTp0Ib/ lJZDYUOtgK+UlH7qY3RdHNOrnhhh+RgQjeLzgezdIE= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id QMDyZZq7AX8C; Mon, 30 Jan 2023 16:48:13 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id BFA821625E; Mon, 30 Jan 2023 16:48:13 +0100 (CET) From: Jonas Bernoulli To: bug-gnu-emacs@gnu.org Subject: lambda inside interactive form of around advice isn't a closure Date: Mon, 30 Jan 2023 16:48:13 +0100 Message-ID: <87tu082fcy.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: none client-ip=212.243.197.30; envelope-from=jonas@bernoul.li; helo=mail.hostpark.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) A function used as an around advice may advise the advised function's interactive form, using (interactive (lambda (spec) ...)). Unfortunately this inner lambda expression is not turned into a closure as demonstrated by this simple example: ;; -*- lexical-binding: t -*- (let ((var :value)) (lambda (fn &rest args) (interactive (lambda (spec) (message "interactive: %s" var) (advice-eval-interactive-spec spec))) (message "body: %s" var) (apply fn args))) Or if you want to observe the failure when trying to use such an advice: (defun -make-advice () (let ((var :value)) (lambda (fn &rest args) (interactive (lambda (spec) (message "interactive: %s" var) (advice-eval-interactive-spec spec))) (message "body: %s" var) (apply fn args)))) (defun -command (arg) (interactive (list (read-string ": ")))) (advice-add '-command :around (-make-advice) '((name . "-advice"))) Could this be changed in the next Emacs release? Even if this should make it into 29.1 (which I doubt), it would still be very useful for me if this could somehow be rewritten to also work in older Emacs releases. I have tried throwing an eval or two in there, but with limited success. This gives me an inner closure, but the outside closure does not capture the same environment it seems: (let ((var :value)) (eval `(lambda (fn &rest args) (interactive ,(lambda (spec) (message "interactive: %s" var) (advice-eval-interactive-spec spec))) (message "body: %s" var) (apply fn args)) t)) I got desperate and also tried things like: (call-interactively (let ((lex '((var . :value)))) (eval `(lambda () (interactive ,(eval '(lambda (spec) (message "interactive: %s" var) nil) lex)) (message "body: %s" var)) lex))) Thanks for your help! Jonas From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 18:33:34 2023 Received: (at 61179) by debbugs.gnu.org; 31 Jan 2023 23:33:34 +0000 Received: from localhost ([127.0.0.1]:55324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pN086-0003Td-A9 for submit@debbugs.gnu.org; Tue, 31 Jan 2023 18:33:34 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pN083-0003TP-GZ for 61179@debbugs.gnu.org; Tue, 31 Jan 2023 18:33:32 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 74846442E57; Tue, 31 Jan 2023 18:33:25 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6A6BA442E56; Tue, 31 Jan 2023 18:33:19 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675207999; bh=QuGtqaS8gFoyk3THL2V9m6bBKU7MvLzJF1CIAPPh2xc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pXUwkieQScTG8NzXYjV++kWhrYliAV3bcW4EcOl2BZmF+UPOvbuOIkL/slxhrcAm8 GlOv3ZpM2AbPnQ9DJmCoMXUTwGIaWFXol4G6WniCzFTyWB6Q1BlYF+GyJtDXcn8Uwt /+pSoLXOH0bK4LF8a+L3XRICuSg4Msfd/ZMn+YfgCkFct6ur4K7TiK9PSoTP2R2G8p ZiREScip9KvXL0ooHbiLHvzdA6sDxuz5srsE8lLtFHG/Ri2iIc96uPg+vi+1QXlxdn qbqAr3qtwVSqDDYFuyj67IddUVpWU1KOQixVERrkgT8nny7iX04BNlroQlc1mP7j+9 T7b5JLTnaUXPw== Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 587C912127D; Tue, 31 Jan 2023 18:33:19 -0500 (EST) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure In-Reply-To: <87tu082fcy.fsf@bernoul.li> (Jonas Bernoulli's message of "Mon, 30 Jan 2023 16:48:13 +0100") Message-ID: References: <87tu082fcy.fsf@bernoul.li> Date: Tue, 31 Jan 2023 18:33:18 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.006 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61179 Cc: 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Unfortunately this inner lambda expression is not turned into a closure > as demonstrated by this simple example: > > ;; -*- lexical-binding: t -*- > (let ((var :value)) > (lambda (fn &rest args) > (interactive > (lambda (spec) > (message "interactive: %s" var) > (advice-eval-interactive-spec spec))) > (message "body: %s" var) > (apply fn args))) Hmm... in Emacs-29, we fixed a part of this problem. E.g. (call-interactively (let ((x 42)) (lambda (f) (interactive (list (lambda () x))) (+ (funcall f) 1)))) should return 43 (even when byte-compiled). But indeed, the fix currently fails to account for such "interactive advice" :-( > Could this be changed in the next Emacs release? Even if this should > make it into 29.1 (which I doubt), it would still be very useful for me > if this could somehow be rewritten to also work in older Emacs releases. The above fix is non-trivial, I'm afraid (e.g. it relies on OClosures internally). For your above code, I think I'd try something like: (let* ((var :value) (interactive-advice (lambda (spec) (message "interactive: %s" var) (advice-eval-interactive-spec spec))) (advice-body (lambda (fn &rest args) (message "body: %s" var) (apply fn args)))) (eval `(lambda (&rest args) (interactive ,interactive-advice) (apply ',advice-body args)) t)) where the last 4 lines are "generic" and could be turned into a helper function if you end up using it several times. This should also minimize the amount of code that's hidden from the compiler by the backquote. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 20:34:04 2023 Received: (at 61179) by debbugs.gnu.org; 1 Feb 2023 01:34:04 +0000 Received: from localhost ([127.0.0.1]:55387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pN20i-0006Rl-4R for submit@debbugs.gnu.org; Tue, 31 Jan 2023 20:34:04 -0500 Received: from mail.hostpark.net ([212.243.197.30]:37296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pN20f-0006RK-3v for 61179@debbugs.gnu.org; Tue, 31 Jan 2023 20:34:03 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id D7DA216289; Wed, 1 Feb 2023 02:33:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1675215237; bh=dqEU6i1VNXgra9eVAqFgmJLI UhWnDFDv9OYHf4sAdoI=; b=eg7VOGOXezuxIfNm+FKc54aVVhpP3geHMh2WUNzr LceWQKwUZ25lFkZS3mTt/ue3RbX7LVhKuUT/JO2dhHJZ9fg2PYw93g7chastkTTL ZFV7cHM5UXTziVQwdZzKqk0RvI0DzOfjMYfuzIYX/Pe1p1ar99akKTCv+tDVWfOE RmY= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id EsGTqtK5QZDv; Wed, 1 Feb 2023 02:33:57 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 80C071622A; Wed, 1 Feb 2023 02:33:57 +0100 (CET) From: Jonas Bernoulli To: Stefan Monnier Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure In-Reply-To: References: <87tu082fcy.fsf@bernoul.li> Date: Wed, 01 Feb 2023 02:33:55 +0100 Message-ID: <87ilgm41a4.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 61179 Cc: 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan Monnier writes: > I think I'd try something like: > > (let* ((var :value) > (interactive-advice > (lambda (spec) > (message "interactive: %s" var) > (advice-eval-interactive-spec spec))) > (advice-body > (lambda (fn &rest args) > (message "body: %s" var) > (apply fn args)))) > (eval `(lambda (&rest args) > (interactive ,interactive-advice) > (apply ',advice-body args)) > t)) I'm having troubles falling asleep because my brain insists on rewording the following (even though --or perhaps exactly because-- there is not really any need to mention it at all). So I might as well try if typing it out helps. ;) I actually though of that, and the initial poc worked. I did that late at night also updated transient to use it. In the morning I noticed that there actually were many errors, and while I suspected that the failure had nothing to do with this part of my change, it still lost confidence in that approach, and since I felt some pressure to get things done before the Emacs pre-release I stopped pursuing it. Somehow I forgot about it when I wrote the above. Now that you have suggested the same, my confidence is back. And now that I have written the above, I should also be able to fall asleep. ;P > where the last 4 lines are "generic" and could be turned into > a helper function if you end up using it several times. > This should also minimize the amount of code that's hidden from the > compiler by the backquote. I'll only need it once; would you recommend using a helper in that case too? > > > Stefan Good night! Jonas zzzzZZz From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 01 17:29:50 2023 Received: (at 61179) by debbugs.gnu.org; 1 Feb 2023 22:29:50 +0000 Received: from localhost ([127.0.0.1]:60072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNLbx-0004le-Pr for submit@debbugs.gnu.org; Wed, 01 Feb 2023 17:29:49 -0500 Received: from mail.hostpark.net ([212.243.197.30]:33132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNLbv-0004lV-A4 for 61179@debbugs.gnu.org; Wed, 01 Feb 2023 17:29:49 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id CC42D164DD; Wed, 1 Feb 2023 23:29:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1675290584; bh=ZPDt/MMJL6ofiyR9MY3zefw6 /XRtDNbygSUB/XMwk/4=; b=sEpQIYpX23auL588nVw8Oy9PJ2EPrWW3+LM0Q9W3 ZJlSMRFLxlTGo+i5qsPfg7bYUjuce+a1fjxpQi0rmCHyWnqIsWetcTXX6ao5IooN m79zDJfL3y+wgBi/Eo3yHrrlSrCThcoku1lksuwiS8H6wAs97ZQ26OMEMq4GsRiV Iz0= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id B1NUEtWwWy8R; Wed, 1 Feb 2023 23:29:44 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 9B8D4164F8; Wed, 1 Feb 2023 23:29:44 +0100 (CET) From: Jonas Bernoulli To: Stefan Monnier Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure In-Reply-To: References: <87tu082fcy.fsf@bernoul.li> Date: Wed, 01 Feb 2023 23:29:44 +0100 Message-ID: <87v8klj9yf.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 61179 Cc: 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan, Could you please have a look at bug#61176 too? The reason I am looking into this around advice business in the first place, is that `post-command-hook' isn't quite working as I expected, as described in that issue. Thanks! Jonas From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 01 17:35:02 2023 Received: (at 61179) by debbugs.gnu.org; 1 Feb 2023 22:35:02 +0000 Received: from localhost ([127.0.0.1]:60077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNLh0-0004ud-Eg for submit@debbugs.gnu.org; Wed, 01 Feb 2023 17:35:02 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:32375) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNLgz-0004u7-81 for 61179@debbugs.gnu.org; Wed, 01 Feb 2023 17:35:01 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0D1D51000D0; Wed, 1 Feb 2023 17:34:55 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 463E710000A; Wed, 1 Feb 2023 17:34:53 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675290893; bh=la8fLewcKr+faMT9Tw9TpUvrf+quLZSZ0r6GcznNHjE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=IrsYHBuYZZYKBuKnjxx0GWJCj4a9D0+ueaYNM0h/uXnVwDwT+RhHWTkM6rQ1tsDWj 5LSTSBj2NwRyjqtHqBgbrSLbegaBDch8FZPERam6A1wQv+ksq4mcxBCICqhYIKMq0V 6QoJO4MIonFoTesM9fkermWM7OAEDmBsgOM55GLFZJopDVkzVfzBtB0Oc7GJvrEpKm /y2vZPQ78X9iUQHi9u6YsD4cyiHSW5QEmosEa6Pt0cCJGJiTNmraHnl5dmOiUwI33C 2h53tQRVDWEFuS1AvzKgPVpMib1EXOqlHHvyqgbS8iflH4DlkwP9fRIiyOUpeNEo3m tDjPOSdIEDzhw== Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0FD591208E7; Wed, 1 Feb 2023 17:34:53 -0500 (EST) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure In-Reply-To: <87ilgm41a4.fsf@bernoul.li> (Jonas Bernoulli's message of "Wed, 01 Feb 2023 02:33:55 +0100") Message-ID: References: <87tu082fcy.fsf@bernoul.li> <87ilgm41a4.fsf@bernoul.li> Date: Wed, 01 Feb 2023 17:34:43 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -1.386 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain GUARANTEED_100_PERCENT 2.699 One hundred percent guaranteed X-SPAM-LEVEL: X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 61179 Cc: 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) > I'm having troubles falling asleep because my brain insists on rewording > the following (even though --or perhaps exactly because-- there is not > really any need to mention it at all). So I might as well try if typing > it out helps. ;) > > I actually though of that, and the initial poc worked. I did that late > at night also updated transient to use it. In the morning I noticed > that there actually were many errors, and while I suspected that the > failure had nothing to do with this part of my change, it still lost > confidence in that approach, and since I felt some pressure to get > things done before the Emacs pre-release I stopped pursuing it. > Somehow I forgot about it when I wrote the above. > > Now that you have suggested the same, my confidence is back. And now > that I have written the above, I should also be able to fall asleep. ;P I hope your slept well. The code I sent is, as usual, 100% guaranteed untested, but it *should* work modulo silly errors. > I'll only need it once; would you recommend using a helper in that case too? Either way works. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 02 09:39:32 2023 Received: (at 61179) by debbugs.gnu.org; 2 Feb 2023 14:39:32 +0000 Received: from localhost ([127.0.0.1]:33014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNakN-00047O-QX for submit@debbugs.gnu.org; Thu, 02 Feb 2023 09:39:32 -0500 Received: from mail.hostpark.net ([212.243.197.30]:37450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNakL-00047E-PX for 61179@debbugs.gnu.org; Thu, 02 Feb 2023 09:39:30 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id B4C3916799; Thu, 2 Feb 2023 15:39:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1675348767; bh=JeP+CntGzimVNulk0CY+N3Ek cojfnJLjqtGIUBgmyo4=; b=IlUe4uvq3pEg5YkalooNuufmFArPZglqHSpuHgbW ee4kAw91PXZfDefFIzdha8dYjhXq2R1Nd4nCPt4NX39L29RZKjZ00n1aOl8+qo22 d7ekEOD5/X0i52g+XcfbOIUe2yYw9ZN1aX9uT5r3GSvzLE3CWSuk3hzZwx4SWuUA V1s= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id kulJpxyKCnAS; Thu, 2 Feb 2023 15:39:27 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 760E7162BA; Thu, 2 Feb 2023 15:39:27 +0100 (CET) From: Jonas Bernoulli To: Stefan Monnier Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure In-Reply-To: References: <87tu082fcy.fsf@bernoul.li> <87ilgm41a4.fsf@bernoul.li> Date: Thu, 02 Feb 2023 15:39:26 +0100 Message-ID: <87pmasjfmp.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Stefan Monnier writes: >> And now that I have written the above, I should also be able to fall >> asleep. ;P > > I hope your slept well. My brain no longer saw a need to keep me awake, so yes. ;) Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.243.197.30 listed in list.dnswl.org] 2.7 GUARANTEED_100_PERCENT BODY: One hundred percent guaranteed 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.243.197.30 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Debbugs-Envelope-To: 61179 Cc: 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Stefan Monnier writes: >> And now that I have written the above, I should also be able to fall >> asleep. ;P > > I hope your slept well. My brain no longer saw a need to keep me awake, so yes. ;) > The code I sent is, as usual, 100% guaranteed untested, but it > *should* work modulo silly errors. I haven't gotten around to play with this approach again yet. The quote inside the function body seems a bit weird. Jonas From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 11:26:35 2023 Received: (at 61179) by debbugs.gnu.org; 4 Feb 2023 16:26:35 +0000 Received: from localhost ([127.0.0.1]:43286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOLN4-0007YN-Tb for submit@debbugs.gnu.org; Sat, 04 Feb 2023 11:26:35 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:6585) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOLN1-0007Y8-7C for 61179@debbugs.gnu.org; Sat, 04 Feb 2023 11:26:33 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 32815808D4; Sat, 4 Feb 2023 11:26:25 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BECB1802A4; Sat, 4 Feb 2023 11:26:23 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675527983; bh=JFnxijjXnTpW/3br+ZdLr4No8bMZyaGmZuOK5jFN9To=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NybIgrnR8hiFEzuRCrUK/8tT3O2oFhpyGDCDLYGcskx/udF3sGwksS+xRYuFmCb8M RbJKvmOkCcUZn14E3JFm7yKujYJrRBP3orXELmRRZL94TDFYFMtMEVoG9SgzI6rNIT hpbHwlzGH9lt2666wc8aaWpS3ZIRU6ZcXregWRaj7Cl/9on1G0JBjMRM4x7abT4YGf /gdmOgvdzMk2fD7RdiiUjqd67MTNWUmFE3YBzyQs/mCGJtc015XP3MZzj3yUGYt1Tz SMvOaFBs23Ubvm+B7OjacLsmyPC58uHEDlo/cN+fjpW7XvdMzxltpYwS1FpxNdjTdn dkUgoZtB0p8Zg== Received: from pastel (76-10-137-88.dsl.teksavvy.com [76.10.137.88]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8E122123030; Sat, 4 Feb 2023 11:26:23 -0500 (EST) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: lambda inside interactive form of around advice isn't a closure In-Reply-To: <87tu082fcy.fsf@bernoul.li> (Jonas Bernoulli's message of "Mon, 30 Jan 2023 16:48:13 +0100") Message-ID: References: <87tu082fcy.fsf@bernoul.li> Date: Sat, 04 Feb 2023 11:26:15 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.167 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61179 Cc: 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > A function used as an around advice may advise the advised function's > interactive form, using (interactive (lambda (spec) ...)). > > Unfortunately this inner lambda expression is not turned into a closure > as demonstrated by this simple example: I installed a patch in `master` which should fix this problem, both for the case where the code is interpreted and for the case where it is byte-compiled. Could you confirm that it works for you? Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 18:48:25 2023 Received: (at submit) by debbugs.gnu.org; 4 Feb 2023 23:48:25 +0000 Received: from localhost ([127.0.0.1]:43625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOSGf-0001ny-2S for submit@debbugs.gnu.org; Sat, 04 Feb 2023 18:48:25 -0500 Received: from lists.gnu.org ([209.51.188.17]:36190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOSGd-0001np-SF for submit@debbugs.gnu.org; Sat, 04 Feb 2023 18:48:24 -0500 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 1pOSGd-000183-Ii for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 18:48:23 -0500 Received: from mout.web.de ([212.227.17.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOSGb-0003u5-Gc for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 18:48:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1675554482; bh=uFy8gQ/r++7jOPjs3P5RMRIKDwEgIDwq7qfQZ38/cDg=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=gYvLtHMVuNjSrBXgD/pmTt2MWf71X823lW1lJf86lk9RI31eFERQTJDiFBzb8gYNA xhf8n/r/4wa7ufnNjpMjIUfXZoRHciWSFDZAxaomime4qfVvzBaqXD9vDDj4MVHwDM ZUH06SH8jLZ0BW5PFs/adVXIfWnwMgrxxtlW7FIYA3ZGKxoyi+tpXMhw3G2iLQpC/J yeJFsOW5rQPjzagaBnBjd9dh8IPWiVhFMcoHSXCZ07rsa3+QHk5zLAQpC7H2Ldzlfn bg+DL/BJwzfT0bU+aaNcduK1vzVdsIY3qakDXaNurmUG93xveIkv+NC7dh9ZhK5Qfg DgQ+vEAfSo/ow== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([84.59.210.57]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MVrbz-1pEixz2f7V-00RqIF; Sun, 05 Feb 2023 00:48:02 +0100 From: Michael Heerdegen To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure In-Reply-To: (Stefan Monnier via's message of "Sat, 04 Feb 2023 11:26:15 -0500") References: <87tu082fcy.fsf@bernoul.li> Date: Sun, 05 Feb 2023 00:47:58 +0100 Message-ID: <87edr58029.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:OSl0cOzhVQwqVicW/OLLkJpil0NBos8hmJlY7ZhP9xxjwAnouo/ cIyAEE2mouYizUASPIiRrdNL+FXfURID7WqFZjDp5JDAXOmDaa7RNFpN+QG78OKK7VkLl2f NkuZkjwZjMGOzj5JsO3EUe7XJB6hc+s0aVrQP8JxXR+vyMSvKZL2hucgMHqnvKNufEQYBs6 oUfAUt984dNqYzD0h4s8w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:VNqLwjz6Vzc=;kc8TYDVhv9WCsP/FfCHCEvh6Shk S/+xDfW4LBdAldcvOehd32GKPWjtBMHnlsDgPi5wVW4dhwgd8OCchf5B35cyQU7NJLdkqJW7N +xj+eZH/PalQGtp8KFH5eDoKkYmlc4vb9haYZBYltFtLNrk9zqi9UOTb8ZjTe043xtOJC1QTM DBFu+HrsuSlzhQv93tspM+xo9sc2ABOxVXj9PzGfKe8FbWb8ZZSQamOunpWoqer7WQkqYCdNv d3osJQU/+XsXsocPdbbrIe724EgnHm4TMQAp8BkleNdsl5yZ57ACOJLVIXjPe8PEphbi8Qi8R DSuXQRuNsGJ8DkRCXE0Uebce4+6/QOxG9N58s0PMSABYRBqs0AKYcaNz7Tbw6g2J//BEJGZYT yF1e8WmKVMgf68lDyqs80PgLNtcDiIYhYzUW1mghaF7gOLInA29xvWGSDmOCzNKLgElrSmuoG eNZ3k/1lZ91UFE7l6PtVc+tUd7sOzCYzfRSM3L6/nVILFnIdTJbTG4Z43JIzfB+NP2OMSMZRB 59hEhrCgADs8+RRxv+LwbXOLgOOBZ4ZAZzRs1k8ftaVFkZEnL/JwESzGiGao8kTM9k5Xnq0zf gN6/8jq3r/W2n3PewD9BTSkR34xBdRbFee8KG3+I3ig2Q1gORKmU5QC0CP0Bk4WJymbT25l0b meVk8gVZvHHa2Fs/Jkz6h2FFFbnnNaD4os6BsQuQ6Mk6oV40hScFZLQzvNpVd5sd8HeRN+9R7 prJHJQOoEtq5kbUGWSwY+BMFN8TokES9n5DlcQ2OM+dx9BdI/zpAfy4e/Q1JVYm3ULE6HpVMu gdNEZZt5gLUt+XMFYDjb2gHVGMMudG9DIzSnxOMOB/6gywiCtVgdEPi2T5nfNXhpmoxoDGj+k C/2ZVLUhUOsszZ/JeQO1r7aEOudedEYIX7HzK1ctIcwa2IZbHeVKTxs9nFxtkhqaTzSwg22JD DGlxuw== Received-SPF: pass client-ip=212.227.17.12; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: Jonas Bernoulli , Stefan Monnier , 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > I installed a patch in `master` which should fix this problem, both for > the case where the code is interpreted and for the case where it is > byte-compiled. Very good. This seems to break some of my private code. Didn't look into your change so far. My code generates function advices with the following semantics: You specify an alternative function and a condition (as a predicate function). When the advice is enabled, whenever the function is called the predicate is first checked for a non-nil result. When non-nil, the alternative function that had been specified is called (recursive calls are bot affected however). When nil, the original function is called. I'm using this hack only in my init file for convenience, I like the semantics for this purpose. Here is a recipe for emacs -Q: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=int-lambda.el Content-Transfer-Encoding: quoted-printable ;; -*- lexical-binding: t -*- (require 'cl-lib) (defconst flag-mel-ad-run-replacement 'mel-ad-run-replacement) (defconst flag-mel-ad-run-original 'mel-ad-run-original) (defun mel-function-replacement-advice (symbol replacement &optional pred) ;; To do: Factor out the advice fun (cl-callf or pred (lambda () t)) (unless (functionp replacement) (warn "mel-replace-function: Unknown function: `%s'. Can't check for interactive form for replacement of `%s'. Please use `with-eval-after-load' or something like that." replacement symbol)) ;; The hard part is getting commands work as expected. ;; We make the interactive spec return an additional flag indicating whet= her ;; the body should run the replacement or the original definition (cl-with-gensyms (test-result origfun args old-spec) (defvar byte-compile-docstring-max-column) (let ((byte-compile-docstring-max-column 999999)) (byte-compile `(lambda (,origfun &rest ,args) ,(format "Replace with `%s' via `mel-replace-function'." (if (symbolp replacement) (symbol-name replacement) "an anonymous function")) ,@(and (commandp replacement) `((interactive (lambda (,old-spec) (let ((,test-result (funcall #',pred))) (cons (if ,test-result ',flag-mel-ad-run-replacement ',f= lag-mel-ad-run-original) (advice-eval-interactive-spec (if ,test-result ',(cadr (interactive-form replacement)) ,old-spec)))))))) (if (if (not (memq (car-safe ,args) '(,flag-mel-ad-run-replacemen= t ,flag-mel-ad-run-original))) (funcall #',pred) (eq (pop ,args) ',flag-mel-ad-run-replacement)) (cl-letf (((symbol-function ',symbol) ,origfun)) (apply #',replacement ,args)) (apply ,origfun ,args))))))) (defun test () 1) (defvar my-ad (mel-function-replacement-advice #'test #'ignore (lambda () t= ))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Worked as I wanted until now. But with your patch installed when compiling the above snipped I get a *Compile Log* saying: | Compiling internal form(s) at Sun Feb 5 00:36:11 2023 | int-lambda.elc: Error: =E2=80=98lambda=E2=80=99 defined after use in (lam= bda (old-spec3) (let ((test-result0 (#[0 "\300\207" [t] 1]))) (cons (if tes= t-result0 'mel-ad-run-replacement 'mel-ad-run-original) (advice-eval-intera= ctive-spec (if (not test-result0) old-spec3))))) (missing =E2=80=98require= =E2=80=99 of a library file?) | int-lambda.elc: Error: =E2=80=98lambda=E2=80=99 used as function name is = invalid Who is to blame? TIA, Michael. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 09:05:40 2023 Received: (at 61179) by debbugs.gnu.org; 5 Feb 2023 14:05:40 +0000 Received: from localhost ([127.0.0.1]:44432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOfeG-0000Xi-8s for submit@debbugs.gnu.org; Sun, 05 Feb 2023 09:05:40 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:55439) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOfeE-0000XQ-O9 for 61179@debbugs.gnu.org; Sun, 05 Feb 2023 09:05:39 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D9C5A440858; Sun, 5 Feb 2023 09:05:32 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6CE66440704; Sun, 5 Feb 2023 09:05:31 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675605931; bh=CtKrzmj+uP4/ZToiGs+ZdvzJaBszsSyZVACeZfKEVuE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=hGSK8TXPPI0GjE7yFKIg6bS7wub29hCVdsoKSsJV+LPPBsU/9le3ZjDNutGrXaBRS hJACW3NcLCQH+f8bvjUDvUJ3Y5WZG5KEuptPOOlVSoQQufjEei3jzI0zcKoDvAsMeO yKnaxEDimSg7ZHdnhjTKmmlNDEY/l5LQhiWSa/smNYiYddPWFY1Ts1rzk/w4ndTUXH yRSubaWxwRholi/nS4rAwOLvrjhia4fvxN5NGjKm2Eu5zh8kaDQ1xW5BfR0a/tt1Jr Fwk5gw5y4QPLVI7B+tsM1dO3OxcKtwi2oKtlC1wZFl63az3r6ZlmpbxeU2yAieFIiv kUzaBQP8qDPLg== Received: from pastel (unknown [104.247.245.112]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 09BC8121336; Sun, 5 Feb 2023 09:05:31 -0500 (EST) From: Stefan Monnier To: Michael Heerdegen Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure In-Reply-To: <87edr58029.fsf@web.de> (Michael Heerdegen's message of "Sun, 05 Feb 2023 00:47:58 +0100") Message-ID: References: <87tu082fcy.fsf@bernoul.li> <87edr58029.fsf@web.de> Date: Sun, 05 Feb 2023 09:05:29 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61179 Cc: Jonas Bernoulli , 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > | Compiling internal form(s) at Sun Feb 5 00:36:11 2023 > | int-lambda.elc: Error: =E2=80=98lambda=E2=80=99 defined after use in (l= ambda (old-spec3) > | (let ((test-result0 (#[0 "\300\207" [t] 1]))) (cons (if test-result0 > | 'mel-ad-run-replacement 'mel-ad-run-original) > | (advice-eval-interactive-spec (if (not test-result0) old-spec3))))) > | (missing =E2=80=98require=E2=80=99 of a library file?) > | int-lambda.elc: Error: =E2=80=98lambda=E2=80=99 used as function name i= s invalid > > Who is to blame? You, of course. But I think the patch below (which I just pushed to `master`) will help, Stefan diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index e4268c2fb88..e8d639903c1 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -488,7 +488,7 @@ cconv-convert (_ (pcase cif ('nil nil) (`#',f - (setf (cadr (car bf)) (if wrapped (nth 2 f) f)) + (setf (cadr (car bf)) (if wrapped (nth 2 f) cif)) (setq cif nil)) ;; The interactive form needs special treatment, so the f= orm ;; inside the `interactive' won't be used any further. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 11:43:31 2023 Received: (at 61179) by debbugs.gnu.org; 5 Feb 2023 16:43:31 +0000 Received: from localhost ([127.0.0.1]:46324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOi71-0004zH-Kt for submit@debbugs.gnu.org; Sun, 05 Feb 2023 11:43:31 -0500 Received: from mail.hostpark.net ([212.243.197.30]:33742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOi70-0004z9-9n for 61179@debbugs.gnu.org; Sun, 05 Feb 2023 11:43:30 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id B315F164F8; Sun, 5 Feb 2023 17:43:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1675615408; bh=cg1eJCuADn+P6oYHmsgHb3go 2osQ0dzyznwVIthvb5w=; b=aOaGj4PvzT5N7hya1sP2IYrrJxHoq7ibm1RshEwS MJLvbnvzS1+U6sckbpxGzSRjy0HhqXFngrREO6HS+DbfSOI6EeJxO0rSMHJoR1Sj +rex/bT/Dq1YvFSMAHqRrvFuU7JDBMvB/KicC1+COH5i5d5FU9Gf39fCsN/gzvr2 8yk= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id ru1AvLgpyp8R; Sun, 5 Feb 2023 17:43:28 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 7C5CF164B7; Sun, 5 Feb 2023 17:43:28 +0100 (CET) From: Jonas Bernoulli To: Stefan Monnier Subject: Re: lambda inside interactive form of around advice isn't a closure In-Reply-To: References: <87tu082fcy.fsf@bernoul.li> Date: Sun, 05 Feb 2023 17:43:28 +0100 Message-ID: <87cz6okqq7.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 61179 Cc: 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan Monnier writes: >> A function used as an around advice may advise the advised function's >> interactive form, using (interactive (lambda (spec) ...)). >> >> Unfortunately this inner lambda expression is not turned into a closure >> as demonstrated by this simple example: > > I installed a patch in `master` which should fix this problem, both for > the case where the code is interpreted and for the case where it is > byte-compiled. > > Could you confirm that it works for you? Thanks a lot! I'll try it out tomorrow (it doesn't seem my brain feels like work today). Jonas From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 13:55:04 2023 Received: (at 61179) by debbugs.gnu.org; 5 Feb 2023 18:55:04 +0000 Received: from localhost ([127.0.0.1]:46452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkAJ-00051S-Ra for submit@debbugs.gnu.org; Sun, 05 Feb 2023 13:55:04 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkAH-00050r-Ba for 61179@debbugs.gnu.org; Sun, 05 Feb 2023 13:55:02 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4F50B440A57; Sun, 5 Feb 2023 13:54:55 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 231F1440874; Sun, 5 Feb 2023 13:54:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675623294; bh=l8zC4Fbz23VB3fio9gFSJM/me42Fb+t1pfz9Te//vno=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=KgKYwILar+c4dTiyK9HbwtPdMWyuEhM8kd+qhrPcQH8f9I6wpMDTtKCPHP7VAXM3k a50CUOwk75N37ygiqcdE2KmqmEKd7k/Dej7zY6E8QkWguehItbZIPpbGYPR34UFFtu /RIo9Lky9Q+8VNrW6zQHnI/uPZx8DFceqtRQp3UwAEaLYmfs2R5T1eSnC0FUR79ak8 m8BnNUf8tRepx5nupKoJ0EtNO5dx/LJxtEYerOpaWVCtVwPWEFkAvs+P6eimXuPUD4 EhGhX+UlRReVjhPvuM2RG5oeqPMHUbyJNWz3nae1Z4CelmymYUPWLgkcYmcf3K6fRx 83kS5/OdIaMfQ== Received: from ceviche (unknown [104.247.245.112]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BF91C1205A2; Sun, 5 Feb 2023 13:54:53 -0500 (EST) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: lambda inside interactive form of around advice isn't a closure In-Reply-To: <87cz6okqq7.fsf@bernoul.li> (Jonas Bernoulli's message of "Sun, 05 Feb 2023 17:43:28 +0100") Message-ID: References: <87tu082fcy.fsf@bernoul.li> <87cz6okqq7.fsf@bernoul.li> Date: Sun, 05 Feb 2023 13:54:45 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61179 Cc: 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Thanks a lot! I'll try it out tomorrow (it doesn't seem my brain feels > like work today). Don't worry: mine is slowly thawing now, so there's no hurry, Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 17:24:14 2023 Received: (at 61179) by debbugs.gnu.org; 5 Feb 2023 22:24:14 +0000 Received: from localhost ([127.0.0.1]:46649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOnQk-0001vX-5X for submit@debbugs.gnu.org; Sun, 05 Feb 2023 17:24:14 -0500 Received: from mout.web.de ([212.227.15.14]:40163) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOnQh-0001vG-PZ for 61179@debbugs.gnu.org; Sun, 05 Feb 2023 17:24:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1675635840; bh=+9c7fwnvI/ccOprPoKo053zIH5Ms7hfRU1nfSkT6k+c=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=QNvmx3x1SBbnpvxEsw7y5fftDkoG6c1tGWF/yO6ebMHSmI9lbAcIbcuYWCQzNp/Td x4EeUuPUnHF5qIvH7hxsxPUbZ0/BF1MCa/oet+d7m3lpU5NUC515ZA+muKuTp1RoaX t7gjIJt1/fUvkroxoWjMiLSijrUeBJ4gVyYZMziqJYPaMdeBLerbCFKOmh0O9qWDt2 9iTYyIBn3sBIyo3BypAHoY+gJ0FQSgP+2VCIYgxlDO9PjOVZDC2eI9NE08qrlu2CB8 8FY7f2EhKHUAL39SndUfngAYSt7jPGQQnqcj8sXgMB1xn1iIDN7RvQMnodXpdXAmzK ZWKzjHLemivwg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([84.59.210.57]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M1JB0-1pRXWE1AvS-002njq; Sun, 05 Feb 2023 23:24:00 +0100 From: Michael Heerdegen To: Stefan Monnier Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure In-Reply-To: (Stefan Monnier's message of "Sun, 05 Feb 2023 09:05:29 -0500") References: <87tu082fcy.fsf@bernoul.li> <87edr58029.fsf@web.de> Date: Sun, 05 Feb 2023 23:23:58 +0100 Message-ID: <87o7q7u4xt.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:tSGv+IPqcrR+u/fvtnIBgsrTky++kRHmPJd0MyEi+YceInnXVjv BQGQSu9qDF09Q5CH7u7qZGf5iCNS1ZX8Zidls7Nf7rwndx+vzW0MT4PtGawwPLaCXP/ES5z S2h5qpxzVUv5y8tD1f64S8L61s8lZ6RTDFHawLgTFxUBRaUPL8GSfVo83Wrm9Qp5cIQhvOU bBt1nWnDa3SCCmzdGZECg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:bru4Otn+xQ8=;WSdK+lI6zTG7R4q3yVCxkaSw3dr Re6anTe/CBuefgx+R/GtFGAzBjfZDRL6VknN1IFBnywdonXZooc6YP3XTcmjspr7KyF9qXDe5 r6xvAgk5Ye+r5WJ7irYVC7n0eBPxJqKXbBc1yynjRRGoTWcTl5Rl2r5K46BbxQkCphTaswlYX WIftmiAwyjTVeyXZ9FwTTEiUll66CeEbTL+gV+9OifsHJgkrxdP0dsKRrInnlHstVqDk+tOqh 4LkEBgDgulLz4GEUbw1EJZWD8mWHqYDUbvqn3vgftrq/u8CFL6FrYaFse0Qs3hZdsXkCKtOyZ BEejd7V487om3VPpf1yvnJ6Fx7Oei2UolRy3qElzCaeWqkINJldfxrH23dCA1RaFz1N2QdlOm c4REZYUviqiNUP88hteKHrDdo5s+crNEQLWuiaC6w4cb11/EbBvK+Ism9ff1qSuDDCJ7Ix63C dLsyvK+KxoAXJcD6gYFQXg8CWu0n98UvAghc4wXqqLiZ4iHVNkd+lZgJScL0MzMSdTezGeZbU zxsQvMlc5CCiAZPXUCkEA79Mz32jhoLG3TQ0KikgirBy90V1S/kMlahUHj4KM/pxIHLL3WGGK RIRWAdoFi//m8Kbj4s+0B1L7lbFbsihIEz47D4kZDEaguy/K0DYnhbkbTr6HiayYpsSC1FreH tqXnIpTkbozyhT63eqlWvJrhNCF+4vo2yoTn/wq8P5eFyKiqlhGTANboKqG13RW5rim+I1nmn ULl6Faz7Zip8LGeCZphGdg2SMfJSIf9AnthpXngkt+KjzGRaiDxCe6T4jBYfreeyiNC6C8Cvh 5okj5uK3O3zrikFkd8AEZAisHG4Q+mbBg8SqBmoqrXEVAbQtUeS7Wg+qrIpji1sikg0YnP22I u7Why39XnHHpyEA448XQlXUv41sSy/hAiXRTn+DRgi2QRYz9aodKrJ02yBbIEUkNX1UpbGd/9 g36eJRY9EJyKADo43tcPBgPyw7c= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 61179 Cc: Jonas Bernoulli , 61179@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan Monnier writes: > > Who is to blame? > You, of course. Oh. > But I think the patch below (which I just pushed to `master`) will help, > [...] Yes, it did, thank you. Michael. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 08 09:38:35 2023 Received: (at 61179-done) by debbugs.gnu.org; 8 Feb 2023 14:38:36 +0000 Received: from localhost ([127.0.0.1]:55144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPlal-0007fV-Mu for submit@debbugs.gnu.org; Wed, 08 Feb 2023 09:38:35 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPlaj-0007fI-A5 for 61179-done@debbugs.gnu.org; Wed, 08 Feb 2023 09:38:34 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 69C2E8089D; Wed, 8 Feb 2023 09:38:27 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 15EE780793; Wed, 8 Feb 2023 09:38:26 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675867106; bh=E9FngTz78Xgm/dw63C17ervJRuB3+G4aTeT3mY5jV3U=; h=From:To:Subject:In-Reply-To:References:Date:From; b=VBqs8/TbHmNLvVCMmDygJ/pVZLDpsN6TRtdbCNmYlxdmg8psusKtKrAJ+nrnvYWUf y9w/S+APoxHZ8iGF1G0UQU9L9fcaymrhHAFTrtySbQT8ZlT6zCHLkOORwuV8EhW0bZ 8e68gt/tPHBahWWMlIxtDKE8bhR7N1ZxGx/iE7Jk9lIsS+7O6m8Gk8ePU7ymnVU1PF dQxsYvxCIyl8XimMs1gQd5Cegx1uH5HcoBE6E33DZbJKDiYp5mqcznCir/XlaN91hD Hvwbskol9UVk6dJVzH8xngjKLWzrueSjtYurYkyIXmcyK0xErCec8cl6xdgXYJOewf 7q84ezzi4+vRg== Received: from pastel (unknown [104.247.245.112]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 91229123068; Wed, 8 Feb 2023 09:38:25 -0500 (EST) From: Stefan Monnier To: 61179-done@debbugs.gnu.org Subject: Re: lambda inside interactive form of around advice isn't a closure In-Reply-To: (Stefan Monnier's message of "Sat, 04 Feb 2023 11:26:15 -0500") Message-ID: References: <87tu082fcy.fsf@bernoul.li> Date: Wed, 08 Feb 2023 09:38:16 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61179-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Could you confirm that it works for you? [ Confirmed. ] Thanks, closing, Stefan From unknown Thu Aug 14 21:45:06 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 09 Mar 2023 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator