From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66991: Confusion in interactive-form with commands with bare interactive forms. Date: Tue, 07 Nov 2023 12:32:12 -0500 Message-ID: References: <83wmut1pb1.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28582"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Alan Mackenzie , 66991@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 07 18:32:37 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1r0PwK-000773-0h for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Nov 2023 18:32:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0PwB-0007d4-2b; Tue, 07 Nov 2023 12:32:27 -0500 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 1r0Pw9-0007bD-DC for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 12:32:25 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0Pw9-0003Nw-3v for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 12:32:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r0Pwj-00080M-Mk for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 12:33:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Nov 2023 17:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66991 X-GNU-PR-Package: emacs Original-Received: via spool by 66991-submit@debbugs.gnu.org id=B66991.169937838030763 (code B ref 66991); Tue, 07 Nov 2023 17:33:01 +0000 Original-Received: (at 66991) by debbugs.gnu.org; 7 Nov 2023 17:33:00 +0000 Original-Received: from localhost ([127.0.0.1]:43241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0Pwi-000806-2C for submit@debbugs.gnu.org; Tue, 07 Nov 2023 12:33:00 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33883) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0Pwg-0007zs-1s for 66991@debbugs.gnu.org; Tue, 07 Nov 2023 12:32:58 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 94150807BC; Tue, 7 Nov 2023 12:32:14 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1699378333; bh=SJmHpl8vlTmOGmkgbCDs3kIVwPqDMt5+ZeK+70c/pOc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=KUETtGKrKClGKJK2Uwf6OZdreK/4fcxd20E/BGq3e0n8EZQmqAkyAkdSUd7rw+UCZ PwdBK3dgxQE6vZg8+cqmnkMPxdZPJTNS8+0MY/cqJuV1d9H027S0g0IfO8CUvaa8fc PogDtjMEIu/BWsyw8upbuyyLSubCrmJ0FCxgA1Z3K0iZcHYVnSYIzsloYneBZNxZuL 0Bp7YAQav3fPS2Ig65wDkI8SAt2eyepn4DGC/quhPnjCOc47IPAvk+V+CsDHCTgD49 MxQhsvnz4KKgh4YSQj553kbHufaEHT+oRG8Bc0LlrleAOGJPjYhf1lXv0n76dysIeU nMnGxSr/GOb/A== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C104B80506; Tue, 7 Nov 2023 12:32:13 -0500 (EST) Original-Received: from pastel (unknown [45.72.212.125]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 97B491203D6; Tue, 7 Nov 2023 12:32:13 -0500 (EST) In-Reply-To: <83wmut1pb1.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 07 Nov 2023 18:49:38 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273941 Archived-At: >> (interactive-form 'x-print-frames-dialog) => (interactive "") # a primitive >> >> (interactive-form 'universal-argument) => (interactive nil) # a native >> compiled command. Both seem acceptable: the form can be either a string interpreted internally by `call-interactively` or an expression whose value will be the list of arguments. It so happens that the interpretation of "" results in an empty list of args, just like nil. There might be commands out there which use alternative ways to express such an empty list, such as (interactive 'nil) [ Presumably as a result of macro expansion of something like ...(interactive ',args)... ] or (interactive (< 4 3)) [ Presumably the result of a prank or some such :-) ] Where/why do you need the representation to be more ... canonical? >> The result is the same from a byte compiled command. >> >> Write (defun foo () (interactive)) in *scratch*, and C-M-x to evaluate >> it: >> (interactive-form 'foo) => (interactive). For non-compiled functions, we just use `assq` on the body. It's arguably not 100% correct, but it gets the job done cheaply. It usually doesn't matter because `cadr` on this result is still nil. >> That's three different inconsistent ways of expressing "(interactive". Different, yes, but I don't see what's inconsistent about it, except maybe for the fact that `interactive-form` can change from `(interactive)` for an interpreted function to `(interactive nil)` for the same function once it's byte-compiled, but note that `(interactive EXP)` will generally change once byte-compiled because EXP gets byte-compiled as well, so you generally can't presume that `interactive-form` returns the exact same data-structure before and after byte-compilation: the two should be "equivalent" but not necessarily identical. Stefan