From unknown Mon Jun 23 23:53:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function Resent-From: Ruijie Yu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 31 Mar 2023 07:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 62563@debbugs.gnu.org X-Debbugs-Original-To: Emacs Bug Tracker Received: via spool by submit@debbugs.gnu.org id=B.168024768316734 (code B ref -1); Fri, 31 Mar 2023 07:29:01 +0000 Received: (at submit) by debbugs.gnu.org; 31 Mar 2023 07:28:03 +0000 Received: from localhost ([127.0.0.1]:60227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pi9B4-0004Lp-Va for submit@debbugs.gnu.org; Fri, 31 Mar 2023 03:28:03 -0400 Received: from lists.gnu.org ([209.51.188.17]:43438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pi9B3-0004LX-Ep for submit@debbugs.gnu.org; Fri, 31 Mar 2023 03:28:01 -0400 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 1pi9B3-0000Bq-3L for bug-gnu-emacs@gnu.org; Fri, 31 Mar 2023 03:28:01 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pi9B0-0004ko-Rw for bug-gnu-emacs@gnu.org; Fri, 31 Mar 2023 03:28:00 -0400 Received: from fw.net.yu.netyu.xyz ( [27.18.235.88]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 844505ea (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 31 Mar 2023 07:27:55 +0000 (UTC) User-agent: mu4e 1.8.14; emacs 30.0.50 From: Ruijie Yu Date: Fri, 31 Mar 2023 15:27:47 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) 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 (--) Hello, I find myself sometimes needing to manually write code that do the same job as the string-form `interactive' would do, like "read for an existing file name" (the "f" form), etc. This happens because I want to do the following conversion.=20=20 --8<---------------cut here---------------start------------->8--- (defun foo (fname) (interactive "f") (ignore fname)) (defun foo (fname bar) (interactive (list (simulate-interactive-f) (get-bar))) (ignore fname bar)) --8<---------------cut here---------------end--------------->8--- In short, this is useful when I need to add an interactive argument that is not already covered by interactive codes, so I have to use the more verbose interactive list form. Currently, the code that handles interactive codes is written as part of `call-interactively'. This is in src/callint.c, DEFUN("call-interactively"). In fact, there is already _a way_ to do it (I consider it more like a workaround). However, I think my proposal might be more concise than the workaround for readers. And also more performant, since the workaround unnecessarily creates a lambda and then extracts its interactive form, only to make use of the result of its interactive code. --8<---------------cut here---------------start------------->8--- (call-interactively (lambda (f) (interactive "f") f)) --8<---------------cut here---------------end--------------->8--- If people are in favor of exposing the interactive codes, I imagine it can be defined as `interactive-handle-code (code &optional prompt)', and I would be able to do this: --8<---------------cut here---------------start------------->8--- (interactive-handle-code ?f) (interactive-handle-code ?M "Insert some random text: ") ;; etc --8<---------------cut here---------------end--------------->8--- Alternatively, if we believe that my c-i + =CE=BB workaround is sufficiently small, we could advise people in the same boat to follow suit? That implies modifying the `interactive' docstring and (info "(elisp) Interactive Codes"). --=20 Best, RY From unknown Mon Jun 23 23:53:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 31 Mar 2023 07:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ruijie Yu Cc: 62563@debbugs.gnu.org Received: via spool by 62563-submit@debbugs.gnu.org id=B62563.168024829717857 (code B ref 62563); Fri, 31 Mar 2023 07:39:01 +0000 Received: (at 62563) by debbugs.gnu.org; 31 Mar 2023 07:38:17 +0000 Received: from localhost ([127.0.0.1]:60272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pi9Kz-0004dx-AN for submit@debbugs.gnu.org; Fri, 31 Mar 2023 03:38:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pi9Kw-0004di-T3 for 62563@debbugs.gnu.org; Fri, 31 Mar 2023 03:38:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pi9Kr-00068p-AK; Fri, 31 Mar 2023 03:38:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GA5PplCPGQMnupKwpcfvRcoDIjaym5ug263+sU8QdBQ=; b=dML/GSPa8p2X NQH1+K1TfBsA4Dx9DBR8PNvLPXHO6tQyQWPtznmdwyD4JLgWzJH8dzX4Oy7fJflBLHxTHMbMkpzGM RqHPHJUrADtgCKYPd5YK3ma3694GQLObo2ne+oMU02AuNMLAfEYCjJJ30AhkPnPiK3ZqHRFi+paL6 oRRr+LBhsS8t87vH9helu2gWyyK9lPN+qfgRTF4W/RKe0aYf0Fod12e6K5mrNTppaknWSdLjRSqiR 3/JFSlo7QeuSkgZWfhiBMFnZTYHEKsz+/hC4DPN+WtCAQueTBmy0lGqaKtmih912ZA2bnRp1JFNtF JHsI58zBWRGcIXx5bt+0Kw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pi9Kq-0005TH-CR; Fri, 31 Mar 2023 03:38:08 -0400 Date: Fri, 31 Mar 2023 10:38:21 +0300 Message-Id: <83lejd2wwi.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (bug-gnu-emacs@gnu.org) References: X-Spam-Score: -2.3 (--) 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 (---) > Date: Fri, 31 Mar 2023 15:27:47 +0800 > From: Ruijie Yu via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > I find myself sometimes needing to manually write code that do the same > job as the string-form `interactive' would do, like "read for an > existing file name" (the "f" form), etc. This happens because I want to > do the following conversion. > > --8<---------------cut here---------------start------------->8--- > (defun foo (fname) > (interactive "f") > (ignore fname)) > > (defun foo (fname bar) > (interactive > (list (simulate-interactive-f) > (get-bar))) > (ignore fname bar)) > --8<---------------cut here---------------end--------------->8--- > > In short, this is useful when I need to add an interactive argument that > is not already covered by interactive codes, so I have to use the more > verbose interactive list form. I don't think I understand the rationale, so please tell more. The interactive spec can be used like this: (interactive "bBuffer to rename: \nsRename buffer %s to: ") So basically, you can prompt for anything using the 's' descriptor and the following prompt string with %-constructs. In what use cases is this not enough, so much so that it would require exposing the guts of this to Lisp? From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 04 04:41:25 2023 Received: (at control) by debbugs.gnu.org; 4 Sep 2023 08:41:25 +0000 Received: from localhost ([127.0.0.1]:48421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qd59A-0008Ou-Qj for submit@debbugs.gnu.org; Mon, 04 Sep 2023 04:41:25 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:57719) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qd598-0008Oe-TF for control@debbugs.gnu.org; Mon, 04 Sep 2023 04:41:23 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5009969be25so1811605e87.3 for ; Mon, 04 Sep 2023 01:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693816877; x=1694421677; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=oMoeVySXZym1NU1/BfC22RGlx/dKuzmjqHRml6cv0uI=; b=VLuwgopSvIgZWXEf5Zoh5ORlWTsE3srKGxhsG9uDvagEQ/MPDZVUYrUsuwVY3FwwIO 0fBejUhxnmDfBl8yEySB119EwTMsYFIgxTPJlxx7vR6R9EwhYV4fl2jw9izrG77FZcUm K7RYo9OzVKlonQfJn1Dnq5K4Ogkr/r27PkJQzbpH3b6O6w4jx64T1wZi46TkZr8u2QML SL/hUO9MnNFvRDpgfYNjPdbx6Jaehq/x681MjKs6HnH1viC49q1TYPkvnJkjIgID2frF h24VeVHprwFnVlsxbr93EJGIcY+g8kbhYZC2J+jdxwdZUqc4d1SNgiSGODkq78hZiuMT kzEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693816877; x=1694421677; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=oMoeVySXZym1NU1/BfC22RGlx/dKuzmjqHRml6cv0uI=; b=Da0p0AY7ARdgs4elkPPmBtblaWgfayhRy9RFqwQqfNLwfpzEL219zkNW5JZ6D6dPSs FHxWjEere7z3qLHQRN91G4H16/VdmpyPsvajx//lPhA9yt2EEjHyRRqER6kcbJUXw8vh DdoiTRZuNeayStBWqCHTadYesroLeAEaAJYX9vGJ0JmsBBKnGixubHUE8n5sJz685cfE tA0tJ4/WEe3IVDEv8HjxybDvknDTyFy8uKFiltww/eYwb1riKkstBJoAZENKFpQGD8xL xrI9uDetgQX5rTp3seBgggbtwfNNQE5GXagb+cPp4UPGB2gwistL7mIr5CAoWWl1eg5F IbAQ== X-Gm-Message-State: AOJu0YzHTwFBaIV1tB/eWSl26wLJNvpADt+8hPV9ox6FI+jCjTfNmSRs N8Gf8XqUSguO60GSoFyuJNmBURwjQjXbDEiJwZaFps+vKmI= X-Google-Smtp-Source: AGHT+IE9evWAbSbJaa65F+EuitxMHZ3/GMLNGEvoTJVnHcZ6+dS/UUHnRatykSINSwXdv+dr4VLY36jxltzgvlpWC/c= X-Received: by 2002:ac2:4d8e:0:b0:4fe:d0f:b4f7 with SMTP id g14-20020ac24d8e000000b004fe0d0fb4f7mr5117794lfe.65.1693816877113; Mon, 04 Sep 2023 01:41:17 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 4 Sep 2023 01:41:16 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Mon, 4 Sep 2023 01:41:16 -0700 Message-ID: Subject: control message for bug #62563 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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 (-) tags 62563 + moreinfo quit From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 11 19:54:43 2023 Received: (at control) by debbugs.gnu.org; 11 Sep 2023 23:54:44 +0000 Received: from localhost ([127.0.0.1]:55251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfqjr-0003QU-MW for submit@debbugs.gnu.org; Mon, 11 Sep 2023 19:54:43 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:44462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfqjo-0003QB-V4 for control@debbugs.gnu.org; Mon, 11 Sep 2023 19:54:42 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-502a4f33440so5113209e87.1 for ; Mon, 11 Sep 2023 16:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694476470; x=1695081270; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=M8lIM0CywOyXBAz41IL4v6vuIU2NTT2etXhfc6Pa23E=; b=F0g/yniBqbpY59vJbYqOEr4PR8NTmrrMc94YKAerMNuvzGRXB55uAPib4IB02rruYe n4pAfFfkwUBof9d8qgCAd1BIQ02ojr47NcPrW0dPbOJARq6zSl4IXdbqnSVmUM7QKCs6 5mfgBJq6M9TE5YMLP47i6xszLmZNgpKMAr9rN4o4IrIQ4g2PAh7GFWiGRX5BU/71ZTbw tdzlUiqWiO05rOqwpy2jTZQiGkUJ1TpLEqiPCFNcuNwrnc98BajfSbAObYsEoT52eYnn M5vukT2UJiiZMsSw6PWH57EbHOTFznj9Ykfx6PueS0QsGLUDA6MRcDYwxZImYSzH8kvL 7vqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694476470; x=1695081270; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=M8lIM0CywOyXBAz41IL4v6vuIU2NTT2etXhfc6Pa23E=; b=KIF7fuZvrRb61ANpXiuDQ2QG2thE6bAOX+K9mhPciVham9Q8TAIrtb8NKoY39SuZs1 wtLKtlx+v/KuWC+cUQXuPPY5RFhtflcnBcpB75tc1FR0N17RcEkRUh+PwokSeVn9Mvyr fTYZTV3/URoui75zYWlfcOLD9lkthaoCo9emy1TZX4jggTzd4Ias+KExbPuURhdAsggY mZtOQx3P7AtlczRVpe5URqqabm1e0yTEYLWTwWjsgy7oV7sFro9mU8vEZfbL4Ky9F8/h 9P/pi3wS6JpS5u56X6r0gkyVn3TNGk1ag0QCOJvVxvpj/jo84Mmc6THGhQTsfsVAX2Bi IIog== X-Gm-Message-State: AOJu0YyxWaW0pojz+knuI71I3SS/BYXR53WA9+ZuTEPeWq4l5y1asYmm DLem3b1+oOYqq+Xc1ewfX0Av+oa1D6X19dAqzyESS2sjQ88= X-Google-Smtp-Source: AGHT+IE1YaTDtnhw4WVAv5que9KuAYndZgznRscVEOB3dpZkERJMP/4UvUvcluhOhTE9DTrmK06UQYubrKCfBVTK15E= X-Received: by 2002:a2e:3109:0:b0:2b9:ef0a:7d4b with SMTP id x9-20020a2e3109000000b002b9ef0a7d4bmr8480535ljx.31.1694476470499; Mon, 11 Sep 2023 16:54:30 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 11 Sep 2023 16:54:30 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Mon, 11 Sep 2023 16:54:30 -0700 Message-ID: Subject: control message for bug #62563 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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 (-) severity 62563 wishlist quit From unknown Mon Jun 23 23:53:23 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ruijie Yu Subject: bug#62563: closed (Re: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function) Message-ID: References: X-Gnu-PR-Message: they-closed 62563 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: moreinfo Reply-To: 62563@debbugs.gnu.org Date: Mon, 11 Sep 2023 23:56:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1694476562-13345-1" This is a multi-part message in MIME format... ------------=_1694476562-13345-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #62563: [FR] Expose `interactive' arg handling as an Elisp function which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 62563@debbugs.gnu.org. --=20 62563: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D62563 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1694476562-13345-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 62563-done) by debbugs.gnu.org; 11 Sep 2023 23:55:03 +0000 Received: from localhost ([127.0.0.1]:55256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfqkB-0003Rg-0r for submit@debbugs.gnu.org; Mon, 11 Sep 2023 19:55:03 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:42477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfqk9-0003Qq-4n for 62563-done@debbugs.gnu.org; Mon, 11 Sep 2023 19:55:02 -0400 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2bcb54226e7so61016281fa.1 for <62563-done@debbugs.gnu.org>; Mon, 11 Sep 2023 16:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694476491; x=1695081291; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=kcm7WsiB7UhEUn5y7crDtEPWdPOgG3RXEqXKz/aGo8c=; b=qH5EsNX0zFGEIdZ+Lf0A5SqxVXUVHNUCVYRpYItUnbxQmVAxAJX4NBVVjr6QaMJSZb snozLjd5oNgd6u/dVG8aToMGUweFuzGv4zYG7V4la8vty9/E3tPkHxNIqmvNYoDcI/XQ rUNx917tz35dMZ5hDt/GaP6yh79EUtwWEjw0eJ/BuxcO+k7jMxO8/3jBu+rDM4L/uQp+ YLAO3LBZtZBkOE9zniQoDdYuClpth59rKa5OlD6QikNCdvazURomYTBi4e7tbft6bXu5 03dogsHP3hZNpXNnJWAiWUNFKjBqQtOHOBEaGUwK3CEi/ORQ5BadbxooaKKr42fIGh9l VLWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694476491; x=1695081291; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kcm7WsiB7UhEUn5y7crDtEPWdPOgG3RXEqXKz/aGo8c=; b=HxikiGRmkE+sPSxwxwF7bCQduC/xxdqInxpxTicKNAYgbd4mRcpgxgE0mEGrO4UzEo rFjOWO0ar1Tt8a3xMk1VFlaR1SIst7DRFPZdpjxxjgwS8oTFeR10Bo1CT5jjsbgSnQwF G3yNDOLuLXjxqOlJtbaYws1R1rJ+QF/vaTKJ4CGmYs0tylTCVepJ0uaLdqmIv/g97jG+ 269eIbVXLd7WFwYilzTOaVjMNeHnKIKNAdredPTxhHflt9hLIEV+zkFFmdYjTqkdJ+4F 7VKQlAsF0egRz94+TkzdqSk1xONoNRB7IAInQ1479DVXBbWqVHPW1RxE/elPrlTKqq/1 GYQQ== X-Gm-Message-State: AOJu0YxmcDDAX9L5CLS6Rq/san/1Go0nQlHVQ//41YMBq+Sr9TMH+KY0 RtoszKaP5kNIjos0koO7BQKsouoxBp3CIfqnntQ= X-Google-Smtp-Source: AGHT+IEiLaQLNgfNAN2qDU12RMpZN1s4qETZWrnq0DSEcCjcW3RFrsaFScQps3ElMmiNJKqfiYWOUsxEd/+Hz5NkwiE= X-Received: by 2002:a2e:b0c2:0:b0:2bc:fd50:573d with SMTP id g2-20020a2eb0c2000000b002bcfd50573dmr389207ljl.23.1694476490813; Mon, 11 Sep 2023 16:54:50 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 11 Sep 2023 16:54:50 -0700 From: Stefan Kangas In-Reply-To: <83lejd2wwi.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 31 Mar 2023 10:38:21 +0300") References: <83lejd2wwi.fsf@gnu.org> MIME-Version: 1.0 Date: Mon, 11 Sep 2023 16:54:50 -0700 Message-ID: Subject: Re: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62563-done Cc: Ruijie Yu , 62563-done@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 (-) Eli Zaretskii writes: >> Date: Fri, 31 Mar 2023 15:27:47 +0800 >> From: Ruijie Yu via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> I find myself sometimes needing to manually write code that do the same >> job as the string-form `interactive' would do, like "read for an >> existing file name" (the "f" form), etc. This happens because I want to >> do the following conversion. >> >> --8<---------------cut here---------------start------------->8--- >> (defun foo (fname) >> (interactive "f") >> (ignore fname)) >> >> (defun foo (fname bar) >> (interactive >> (list (simulate-interactive-f) >> (get-bar))) >> (ignore fname bar)) >> --8<---------------cut here---------------end--------------->8--- >> >> In short, this is useful when I need to add an interactive argument that >> is not already covered by interactive codes, so I have to use the more >> verbose interactive list form. > > I don't think I understand the rationale, so please tell more. The > interactive spec can be used like this: > > (interactive "bBuffer to rename: \nsRename buffer %s to: ") > > So basically, you can prompt for anything using the 's' descriptor and > the following prompt string with %-constructs. In what use cases is > this not enough, so much so that it would require exposing the guts of > this to Lisp? More information was requested, but none was given within 6 months, so I'm closing this bug. If this is still an issue, please reply to this email (use "Reply to all" in your email client) and we can reopen the bug report. ------------=_1694476562-13345-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 31 Mar 2023 07:28:03 +0000 Received: from localhost ([127.0.0.1]:60227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pi9B4-0004Lp-Va for submit@debbugs.gnu.org; Fri, 31 Mar 2023 03:28:03 -0400 Received: from lists.gnu.org ([209.51.188.17]:43438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pi9B3-0004LX-Ep for submit@debbugs.gnu.org; Fri, 31 Mar 2023 03:28:01 -0400 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 1pi9B3-0000Bq-3L for bug-gnu-emacs@gnu.org; Fri, 31 Mar 2023 03:28:01 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pi9B0-0004ko-Rw for bug-gnu-emacs@gnu.org; Fri, 31 Mar 2023 03:28:00 -0400 Received: from fw.net.yu.netyu.xyz ( [27.18.235.88]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 844505ea (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 31 Mar 2023 07:27:55 +0000 (UTC) User-agent: mu4e 1.8.14; emacs 30.0.50 From: Ruijie Yu To: Emacs Bug Tracker Subject: [FR] Expose `interactive' arg handling as an Elisp function Date: Fri, 31 Mar 2023 15:27:47 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Debbugs-Envelope-To: submit 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 (--) Hello, I find myself sometimes needing to manually write code that do the same job as the string-form `interactive' would do, like "read for an existing file name" (the "f" form), etc. This happens because I want to do the following conversion.=20=20 --8<---------------cut here---------------start------------->8--- (defun foo (fname) (interactive "f") (ignore fname)) (defun foo (fname bar) (interactive (list (simulate-interactive-f) (get-bar))) (ignore fname bar)) --8<---------------cut here---------------end--------------->8--- In short, this is useful when I need to add an interactive argument that is not already covered by interactive codes, so I have to use the more verbose interactive list form. Currently, the code that handles interactive codes is written as part of `call-interactively'. This is in src/callint.c, DEFUN("call-interactively"). In fact, there is already _a way_ to do it (I consider it more like a workaround). However, I think my proposal might be more concise than the workaround for readers. And also more performant, since the workaround unnecessarily creates a lambda and then extracts its interactive form, only to make use of the result of its interactive code. --8<---------------cut here---------------start------------->8--- (call-interactively (lambda (f) (interactive "f") f)) --8<---------------cut here---------------end--------------->8--- If people are in favor of exposing the interactive codes, I imagine it can be defined as `interactive-handle-code (code &optional prompt)', and I would be able to do this: --8<---------------cut here---------------start------------->8--- (interactive-handle-code ?f) (interactive-handle-code ?M "Insert some random text: ") ;; etc --8<---------------cut here---------------end--------------->8--- Alternatively, if we believe that my c-i + =CE=BB workaround is sufficiently small, we could advise people in the same boat to follow suit? That implies modifying the `interactive' docstring and (info "(elisp) Interactive Codes"). --=20 Best, RY ------------=_1694476562-13345-1-- From unknown Mon Jun 23 23:53:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Sep 2023 00:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo To: 62563@debbugs.gnu.org Cc: ruijie@netyu.xyz, stefankangas@gmail.com Received: via spool by 62563-submit@debbugs.gnu.org id=B62563.169491183320082 (code B ref 62563); Sun, 17 Sep 2023 00:51:02 +0000 Received: (at 62563) by debbugs.gnu.org; 17 Sep 2023 00:50:33 +0000 Received: from localhost ([127.0.0.1]:48764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhfzc-0005Dp-MC for submit@debbugs.gnu.org; Sat, 16 Sep 2023 20:50:32 -0400 Received: from mout.web.de ([212.227.17.12]:44467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhfzX-0005DW-2H for 62563@debbugs.gnu.org; Sat, 16 Sep 2023 20:50:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1694911813; x=1695516613; i=michael_heerdegen@web.de; bh=S5rEfkXiFJD0Sd2Z4e3Qq0R5v0CEQZBegUN0mkRk5i4=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=HSKYRqryglv/vmhXV0ofNytk4dUioAQ5j0XD2us1y6Dwf87WvDMWGJ3fOubTWeJa39R3ALTiE42 S5aoFX5OeVULTQnmNN5sv3wbkpI9lylaiq+2D0KIWdgxLGzPJMr3uBD95CYCu20wFBchiHBp4em1K psLkz5l8/pJhi0JKMU9pHC+dBakmE2pBHdkCApVii7rZm5RKvUu70Nm76iKzLwMinUsqpl5fqIAS/ Jz7nDxn7RZ6kJ23DsKtwbGBIv+ndiO9JD292r4WV4bReYh6mWxUmMODeKNVhziyD6XSHyOGze8RY3 RyF1N4iLTeq5wx9ctfKdlrNyW5WZYA9tIAHQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M2gkf-1qiUP53Y2Z-0048MP; Sun, 17 Sep 2023 02:50:12 +0200 From: Michael Heerdegen In-Reply-To: (Stefan Kangas's message of "Mon, 11 Sep 2023 16:54:50 -0700") References: <83lejd2wwi.fsf@gnu.org> Date: Sun, 17 Sep 2023 02:50:12 +0200 Message-ID: <87bke1d3nf.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:Zx8rMVpQrxVMOkNM0tP2A+PZDfhHuC23PsCc4dM2BfWgAN23Pcb at5UWo1wNMIGddzHNLusPeqVU2kHX1WvvmUUBnFMNNqaiUT3sPkcYJ/BtNYU6zSqtVup0ks Yc6c3YudliRAvv2+4RG+IFR5LW0+LMD1y8hc8dE41BaQO9L2XxBwq/zzPrbShGLQeLpDh3F FoqNvg8UrBkJF3DSwicyg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:m6WYOCVdHYQ=;ewwMgnQg/YBMkX3UcJYEBOHcA2G HCXwqgZskpjQAWXUEDCZk6QZ6Ap5NB2jCl+hZ/hb6OXYEuMuCaoBUkwpxcIgYH68c1QLzGQ3f E6cmlc2O8mWG7/W76sRmUgO38P0vxmDmqHvfDLc92X37VattYoKKrvIy+Fo4ttudAkvlb5qhk XYqLMZ74EifxzNqFjn6ub3XRWbJ2HUlj1LayS0dUkxIDlzqsgfkUh9xoCgqOCuFWcvMa/Jq32 4TBcC45gKsdhSjAnUMNP8DL/E6AUz2CPjCDKP+Kls9ZlDXFNqDJO3T8vaUebI2f9x5nIveGW5 981QGASPn8SAZ77V1JS4NdJD5yUIC+6hlPKou3/UJxxFbBj0AgOYR5Q0r5e5wUrnN1wlkTNU9 ToQQcryFRYoeNClqWPn6i5Soma5ablcEX8JHV4QTDVmP3SbZ6OqqrGBDMHh3K6duuURmiGSz1 B0X359Moy8nd/kikHNUmqxXYqgZnVVMwjPK/WXVq0OTvVBvGBfNkU3GB+VKNp+TPJCjR+atG8 ebjc0YYClQnCTpQN44P5maQkePDjhkbTygMFcKLX+I1n+h4n3HpUckVcGh11Dx6khCPE8nRk3 q9RyQpOCmHO8eyCaKLhIxsd3LbEZUakKmgsPWQ7aDOEAfR4Nwvalw6z9fMjlPdiz/pimqCTHz HrJ3Q18karM1DD6zl2wt5rKf02kmlDbuuf7nKJQBW0A14KPYwyh+yyhv1VtfJkzTvQ0Z23BCc LIqSmXhChC86yQzFD95DTBIOpSPG/cFnVuzLDeDtVO8MBsZadknsBlmkHpeJP90FzHX9+pGR5 Qs85GF1uxXO6K2HQ2lVKirEQapWtFA+x4I1KAX/1zBjZ2ocC7hHBbB516CNI/ow8/HbeXLsS4 mrZHKxBBymHsS0R/BGSZZku1DGlYbyp02Ebp2y+P6ZIzFC6IWnmjWl7FVksQihlQ6m4XhT3j9 F/LA90neqcyamdju0M4mzAt/vTQ= X-Spam-Score: 0.0 (/) 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 Kangas writes: > >> --8<---------------cut here---------------start------------->8--- > >> (defun foo (fname) > >> (interactive "f") > >> (ignore fname)) > >> > >> (defun foo (fname bar) > >> (interactive > >> (list (simulate-interactive-f) > >> (get-bar))) > >> (ignore fname bar)) > >> --8<---------------cut here---------------end--------------->8--- Something like this can be useful if you need to read an additional argument in a way that involves the need to run some Lisp, where using a normal code letter is not enough. Then you need to substitute the other code letters you still want to have been read also with Lisp code. Is that understandable? We have `advice-eval-interactive-spec' which can be used like (advice-eval-interactive-spec "f") - that comes very close to what is requested here. Combined with `interactive-form' one can use this to simulate the argument reading from a given command from Lisp. `advice-eval-interactive-spec' has a FIXME: | ;; FIXME: How about renaming this to just `eval-interactive-spec'? | ;; It's not specific to the advice system. Any opinions whether we want to do that? If the implementation is not something ugly (it probably is, a bit, though), I would vote for it. Michael. From unknown Mon Jun 23 23:53:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Sep 2023 11:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo To: Michael Heerdegen , 62563@debbugs.gnu.org Received: via spool by 62563-submit@debbugs.gnu.org id=B62563.169495033421178 (code B ref 62563); Sun, 17 Sep 2023 11:33:01 +0000 Received: (at 62563) by debbugs.gnu.org; 17 Sep 2023 11:32:14 +0000 Received: from localhost ([127.0.0.1]:49239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhq0b-0005VW-Kk for submit@debbugs.gnu.org; Sun, 17 Sep 2023 07:32:13 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]:46248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhq0Z-0005VI-OV for 62563@debbugs.gnu.org; Sun, 17 Sep 2023 07:32:12 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2bf8b9c5ca0so58234261fa.0 for <62563@debbugs.gnu.org>; Sun, 17 Sep 2023 04:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694950318; x=1695555118; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc:subject:date:message-id:reply-to; bh=MjnHQtGdfvbA/YxBQkTK75Ifz4/B2vDny8tbJc4M7fQ=; b=hpLviIdAk/mtQeix/23KUwF8Ezj+Eeq/fTTclQ4MrTTn6i+SlMusak5bupFkbuFPLY uFZNmsTNB7n6cg6f75u/CRPRScgSNtukfj/Nevpxor4VSaLbvJtaQjw6tUeOKde6nqbh Fc10WjI25G5o86cXpF8OnAM+B4yJ5jTd0ew4ThuEBJCQrCfKnKamWu2lSIEz9lTkJHE0 zfEdMA2xHCf5sfYv9g9C0NDgUyLLNYj49y/1pjHGnHpThWt+DKK2YUjyqeMJQ8OeYfvz injIjz4gN9rVn4aX+F3GxS7zh0TsEz3DZXtoG3i7DWUPxwHAvb6C0E9eMbXazReOLGfh 8lIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694950318; x=1695555118; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MjnHQtGdfvbA/YxBQkTK75Ifz4/B2vDny8tbJc4M7fQ=; b=kgiaNnMeHYALyPKHKRJs5VG9MSKS/dHWr/fjX3eQtKTanLXWGBjOnQ51hcOHunFjbs wgkVDUGyTHSLJxduGip1FAYtZm4JB8KM3CPxNNVBvb+2iglCYotGU/Y+RB50cI151nNe O4L1qnvCijdHOoCnKHutYzwITtnyV6u07SA1cWoNYGKCNckTqpWl4VQzUMB2D+smvHAI nqAlLT5YbhebhXKqVisinKLQVKOQgvNK/15WxQcoGXXAHIFo2ng/1Z4/Cico9D2r5zCB cP3iY8J4VJb9O9eKsGIIBXEkO50xYhG8u0yPQo5aBC9i8BnXCUTN9K0rEpw9aipYrrMZ 335w== X-Gm-Message-State: AOJu0YyHZ/ffQlxiPkJld0z9i2Tcg36dyOk56gwjEzsmZDwBvtEi02SY BiEXc1C3/BKFRr2+/ruEie6IdtNpmCp2U+bADrE= X-Google-Smtp-Source: AGHT+IGGarfl4rNmaB9YelsoW3T8/NC7F31n7OGt0RCQ7yoj9OVLSgcejGmZ4+hZtBaegwpFR6cH2WhDHsNLx/0MZ8g= X-Received: by 2002:a05:651c:1a27:b0:2bf:f5c9:2dce with SMTP id by39-20020a05651c1a2700b002bff5c92dcemr2919546ljb.30.1694950317947; Sun, 17 Sep 2023 04:31:57 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 17 Sep 2023 04:31:57 -0700 From: Stefan Kangas In-Reply-To: <87bke1d3nf.fsf@web.de> References: <83lejd2wwi.fsf@gnu.org> <87bke1d3nf.fsf@web.de> MIME-Version: 1.0 Date: Sun, 17 Sep 2023 04:31:57 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) 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 (-) Michael Heerdegen writes: > Stefan Kangas writes: > >> >> --8<---------------cut here---------------start------------->8--- >> >> (defun foo (fname) >> >> (interactive "f") >> >> (ignore fname)) >> >> >> >> (defun foo (fname bar) >> >> (interactive >> >> (list (simulate-interactive-f) >> >> (get-bar))) >> >> (ignore fname bar)) >> >> --8<---------------cut here---------------end--------------->8--- > > Something like this can be useful if you need to read an additional > argument in a way that involves the need to run some Lisp, where using a > normal code letter is not enough. Then you need to substitute the other > code letters you still want to have been read also with Lisp code. Is > that understandable? Yes, I think that explanation is clear. > We have `advice-eval-interactive-spec' which can be used like > (advice-eval-interactive-spec "f") - that comes very close to what is > requested here. Combined with `interactive-form' one can use this to > simulate the argument reading from a given command from Lisp. > > `advice-eval-interactive-spec' has a FIXME: > > | ;; FIXME: How about renaming this to just `eval-interactive-spec'? > | ;; It's not specific to the advice system. > > Any opinions whether we want to do that? If the implementation is not > something ugly (it probably is, a bit, though), I would vote for it. Could you point to one (or more) examples of real code that would have been made significantly simpler by this? The idea sounds good in theory, but it is important to understand if it will also be useful in practice. That will give us a better basis for deciding if this is something we would want to add or not. From unknown Mon Jun 23 23:53:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Sep 2023 04:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo To: Stefan Kangas Cc: 62563@debbugs.gnu.org Received: via spool by 62563-submit@debbugs.gnu.org id=B62563.16950113161474 (code B ref 62563); Mon, 18 Sep 2023 04:29:02 +0000 Received: (at 62563) by debbugs.gnu.org; 18 Sep 2023 04:28:36 +0000 Received: from localhost ([127.0.0.1]:51820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qi5sB-0000Ni-Kb for submit@debbugs.gnu.org; Mon, 18 Sep 2023 00:28:36 -0400 Received: from mout.web.de ([212.227.15.14]:36375) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qi5s5-0000NK-Rx for 62563@debbugs.gnu.org; Mon, 18 Sep 2023 00:28:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1695011295; x=1695616095; i=michael_heerdegen@web.de; bh=8rPGd+V8NfleNwRRqoPqBBkRQCBi51wSPafvNbreNk4=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=KoAWMi37FUkUlbQGHFsPjH0uI3MtFJ8oDxaMh3Y3KlESHt7Sdit+/nbD2eFV9EWiD14AiQTYRbv 2DZNXW+qjuR11gSLOGcpizB3ldnS0G2gsWiYgOlxPT27XvPBYDZ0oCpbFfI4lnAYqNjwxl88fOw25 iwrO5QJfZJohSotQNIMvnB8GRpQPM3D7zaApeIk7dx74fHZSJXIANE08JOlw7KSUa7E+UhkW6WXjx H2oMQ5uqgAQmpQhTnCzpMnpxXeRfShkLCt1LS5cVNs/grPDmOEPTnAMizFpMcqAVVXywzzw2EnRfV s0X//r5dvxlFwt/9YpMhV9TgD5cNC52DZ/ag== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([88.66.201.191]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MOUtm-1r4ZST0xUk-00PzWH; Mon, 18 Sep 2023 06:28:15 +0200 From: Michael Heerdegen In-Reply-To: (Stefan Kangas's message of "Sun, 17 Sep 2023 04:31:57 -0700") References: <83lejd2wwi.fsf@gnu.org> <87bke1d3nf.fsf@web.de> Date: Mon, 18 Sep 2023 06:28:14 +0200 Message-ID: <875y486r6p.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:TTmw+6/R0KKBiJ1I2IAYA0t5mo0yx+6fXq37uYNK5fXxpaPEPLS kox4qxQy7GZgqCDSbfYTfSzY1pTwtZeW7LFR1xSaJwBHX6FvpXsalpT5ox7FGRnDlDlTy65 S3FVlEtNn0dMe7vwDdfP9cznOXuDlLDQHUB3YyChOBofA3Vjg2m752gQgWxrrpVbEPvz7vj Fa3OauPhp/YPr9AYCAdQQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:z6nRjfEV04E=;qgeWO8SmazaL3gSgW97t+Y16e9e UjHcdGUC+kjVURYBq4vVUZ9+qKzuDRPCfIGDhgT1KrltdLk+NcfhB3z5oXAQETrd6WSTlmrm+ EiQC+/Nle+PVExUBwVGNZZr1l0I+/bFQAPa68pf0a9eg0bT3F3+0D6ECPdf91sMk8MnYBRrD0 Nlvja6HZlVNh9pHBbtxoAhgwhYXwaDHSz3mDGF/I0vKhsUe9fRDKfpu5D2zwht7hc7FRcAIcn zCkomnKB97iL7t+l7Rn21TexIXnv46l+klkGViiOLGg0odFYx2888xC1j8j182y8S/ch+pRur ZfEZmWBY4aTYwXt4v9Zw+k6WGd2egT1xTuBchOba0CeauwT9VVzue68+XLNxo4pOy6vENahfQ a6HvM1Ta+TJ1A5/31e94SHKvBgT+xty98CjNv5Q/xmf1Lwtzj9DfonJGK7rzgLWZSvbgHv5E6 aysj/9G3A4iF+vhGuPCcq5Awd4oScxyFZ6VRKoWBuWJrv63s6e8fC/KMp6ssdUHg5LURsUuw2 uenvgQ4bvPgirNxvsNH30i/B+68dv7uJVW91VEXzO87Z793sbVuJpnAxbUAZJE3wEiiC6WI2k kBui9UfEfjkBEEH7C5XTPUfJxiW98SjlKjCwnc4v2rplJp86XspwHQ1yWLrFMZNXuOsrSfcu9 HsQoAJBhEkJV7ykZy5d63Pp7ZoK0X7dZVYhF9SaquYKL1lII6carful6Dg/rs9Z6GLE4UF0B4 Q4ryhW9QKzfSNJ4rBiefll6oLhKS0i73IA3S4vBGduqjTZ5HjhLO16goxzvddiFIhN7S2zzip efIPKk+pcnRPLiJOS6BONkZytyJmbONO98eG0vyKn9G0m6afUmWrxH8oh0UTOIM/7W2hz2DHl pGvVUKGRcoL4NW0HMQEwg7hZiJFF+YvUyNp7CIedaOMvkAi8apr+cs3KocKdSY/srx9Q3WWFO r3ODParmaqx/eGhZiGOsZcKeBJU= X-Spam-Score: -0.7 (/) 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 Kangas writes: > Could you point to one (or more) examples of real code that would have > been made significantly simpler by this? The idea sounds good in > theory, but it is important to understand if it will also be useful in > practice. That will give us a better basis for deciding if this is > something we would want to add or not. [ Note I only asked about renaming `advice-eval-interactive-spec' to `eval-interactive-spec', not about adding something new. Because the function is not only useful in nadvice.el. Dunno if I made that clear. ] People can of course already use the name `advice-eval-interactive-spec' - but it is probably not well known. Ehm - examples, ok. Whenever a package or config file wants to define a variant of an existing command that needs to read in the same arguments in the same order (i.e. the user wants to have multiple commands instead of one, an additional definition, not an advice), one has to copy the interactive spec of the original definition. Or one can use `advice-eval-interactive-spec'. The body of the variant also may or may not reuse the other function. This is all very similar to defining advices - only that it doesn't involve an advice, as I described. When the variant of an existing command wants to skip reading one argument, `advice-eval-interactive-spec' is not of much use. But the same is true of advices of interactive functions that want to skip reading an argument. In the Emacs sources it's possible to factor the interactive spec out into its own defun and reuse it in several places. So this kind of use case is mostly relevant for external packages and user configurations. Ok, you wanted a real life example. In my init file I have a command like this: #+begin_src emacs-lisp (defun my-dired-restrict-marks () "Restrict marks using the following command. Only files that are currently marked and are marked again with the subsequent command will be marked afterwards. Thereby only `dired-marker-char' marked files are considered - other marks are not touched. The next key sequence can optionally be prefixed with key ! to mean \"not\" - then only marked files that would _not_ be marked again with the next command keep their mark [...] ... ) #+end_src That way I can combine several marking commands to have files marked fulfill more than one condition. If I bind the above command to `&', I can use * / & * % to mark directories whose name is matched by a certain regexp, for example. The implementation saves the current file marks, reads a key sequence, determines the bound command, then evals the interactive spec to get the arguments (it is better to do this using the original buffer state, this is the important part here). Then all marks are removed, the command is called with the read in arguments (simply using `apply'), then the marks are merged with the remembered marks. A similar case is my command `my-profiler-profile-next-command': It similarly reads in a key sequence and the according arguments using the interactive spec, but only after that starts the profiler and calls the body of the command. This is nice if you want to avoid that the argument reading messes the profiler results of the command's code. Yes, such things, but admittedly, the large majority of calls of `advice-eval-interactive-spec' is still for defining advices. I also want to add that what I describe here is related, but not the same as the request in the original report which, AFAIU, more asked about a convenient way to simulate (interactive "f") conveniently from Lisp. If we would have access to the code reading in the individual arguments that would be even nicer, but it's not possible in the general case because the interactive spec returns a list that is the result of any arbitrary code that returns a list (i.e. there is no separate code for each single argument in every case). I let you decide whether my examples are enough to justify this renaming. There are probably not that many use cases, still, there are a few. Michael. From unknown Mon Jun 23 23:53:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62563: [FR] Expose `interactive' arg handling as an Elisp function Resent-From: Richard Stallman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Sep 2023 10:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo To: Stefan Kangas Cc: michael_heerdegen@web.de, 62563@debbugs.gnu.org Reply-To: rms@gnu.org Received: via spool by 62563-submit@debbugs.gnu.org id=B62563.169511888527678 (code B ref 62563); Tue, 19 Sep 2023 10:22:02 +0000 Received: (at 62563) by debbugs.gnu.org; 19 Sep 2023 10:21:25 +0000 Received: from localhost ([127.0.0.1]:55414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiXrA-0007CL-IZ for submit@debbugs.gnu.org; Tue, 19 Sep 2023 06:21:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiXr5-0007C7-SV for 62563@debbugs.gnu.org; Tue, 19 Sep 2023 06:21:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiXqr-0007uC-HK; Tue, 19 Sep 2023 06:21:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=cqoecjyIP7+zrD3IAEoMECJ5Tmuu4Q8p4sWjjCvrLik=; b=R73cfGhVPxUI M82WDhhnZp4lTH1tvZTgisGm0UugJOkReD85I95x211J5+rz9PefQIN70RFxMW38ebQS4Ilr8bucA t3ARPu5bedEchvCvIamTkQkxUa3YkHncKlEJeiscwTNITsf69mh0ik/aQrG1LxnGV/KsyTuGbaG/K s7aTAxQBjopbpA8QjxiPUIea7J6Eo4tbZzb6uUTyep0qz3Nrmy5b0sn+km0d6U+gh1/2+ks3K47Bw s1mKP6DqIErVwMnsyLRf7VNT00FNA9w1aw1W5etj3oNUAVbJmlTn7BVvITm1NQ+vpz8ATzNvJlg1Z C2EjJBKRuUTEKc79Da/Jww==; Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1qiXqq-0004do-P5; Tue, 19 Sep 2023 06:21:04 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman In-Reply-To: (message from Stefan Kangas on Sun, 17 Sep 2023 04:31:57 -0700) References: <83lejd2wwi.fsf@gnu.org> <87bke1d3nf.fsf@web.de> Message-Id: Date: Tue, 19 Sep 2023 06:21:04 -0400 X-Spam-Score: -2.3 (--) 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 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] In general, each interactive spec can be programmed with Lisp code inside `interactive'. But maybe there are some exceptions, Which ones are exceptions? If we post the list of those, maybe we can provide a simple specific solutions for them. Also, maybe people will point out existing ways to handle some of the codes that were first thought to be "missing". -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)