From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.devel Subject: Re: Adding eval-command-interactive-spec Date: Sun, 15 Jan 2023 11:00:29 -0700 Message-ID: <87edrvk79e.fsf@melete.silentflame.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33749"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 15 19:01:19 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pH7Jk-0008cg-DC for ged-emacs-devel@m.gmane-mx.org; Sun, 15 Jan 2023 19:01:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pH7J5-0000qd-Qe; Sun, 15 Jan 2023 13:00:35 -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 1pH7J4-0000qS-E6 for emacs-devel@gnu.org; Sun, 15 Jan 2023 13:00:34 -0500 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pH7J2-0002Cf-FH for emacs-devel@gnu.org; Sun, 15 Jan 2023 13:00:34 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id B450C5C010F for ; Sun, 15 Jan 2023 13:00:30 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 15 Jan 2023 13:00:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1673805630; x=1673892030; bh=q8Xu+WQuqx YxH/INv3+AkkudAwW+pT4aFWwVX58X+oU=; b=o2cBCMYVXjWXRGT1gNOmXqL8C0 eUf63Yh1WZID8ML9SPg9WLD3wr8uii/zWVseUt9LOqESsyxfRTc0QTU5b9kRvF9d n/xC1pKFSTM9q2Q8g7BPyXGnYNkDG83ARCMQkjBr9ukii1iMq2Fk1cD7CIUHG9K8 3YJBjKdqohjk9uFsG5AdBW8+HOIBZLiddqItvBML8JcwC6onj0Vo3gnioxauLBMg HmI50QeoNRPWq0Izci/R3Hc17FDVSoCeTmXkX1x8kCKIbIHklIUPQbXwR25fEpdh 1u/qT5ysYllC9cURY1D7qlPcKX/LjypRCbIMEqNMw011JhU8UGL/pc8abXVA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1673805630; x=1673892030; bh=q8Xu+WQuqxYxH/INv3+AkkudAwW+ pT4aFWwVX58X+oU=; b=Q7G31Hx9U6t7GLcW5z2+8Aw6jLwnon3UWmgRjuzSsIDR MHF0APZkAUEncyCudcuiYM0svzLRfZUvgIUxREYw1d6934nTE2y9eHsruk4MnOSo qaSep6beSfo0B/bomAgIRyx7ocPMS6ewCkNbUw88cTH1bM1GSr2JZzEbX1bC59Hb zzuwP3IZ0Z6dTxOwaExv5brwViBCAP9tgkAmV5LZFhsaRm3mLaF3jyTS2DREx2o1 OAQB9RiJlHIH2DasFoTYKdKdK1JuOBd6Ftab/ZJSsZOs7cICO/Dg5n+mlJ6GpMpb 13F8GllOr9mssWN707gk/qUre8dTwpcsNo0EHmtFgQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddtvddguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfhffkfgfgggtsehmtd dtredtredtnecuhfhrohhmpefuvggrnhcuhghhihhtthhonhcuoehsphifhhhithhtohhn sehsphifhhhithhtohhnrdhnrghmvgeqnecuggftrfgrthhtvghrnhepkeevleffheetle ehteeludetjeehfeehgfetteeftddtjeejjedvveevgfeghfehnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhpfihhihhtthhonhesshhpfi hhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 15 Jan 2023 13:00:30 -0500 (EST) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id 3828C7F14AE; Sun, 15 Jan 2023 11:00:29 -0700 (MST) In-Reply-To: (Sean Whitton's message of "Tue, 3 Jan 2023 05:41:22 +0000") Received-SPF: pass client-ip=66.111.4.27; envelope-from=spwhitton@spwhitton.name; helo=out3-smtp.messagingengine.com 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_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302437 Archived-At: --=-=-= Content-Type: text/plain Hello, On Tue 03 Jan 2023 at 05:41AM GMT, Sean Whitton wrote: > I think that it would be useful to have this: > > (defun eval-command-interactive-spec (command) > (advice-eval-interactive-spec > (cadr (or (and (symbolp command) (get command 'interactive-form)) > (interactive-form command))))) > > but I'm not sure where it should go -- nadvice.el? subr.el? subr-x.el? I realised after reading the commentary in subr-x that that's exactly where it should go -- it is a complement to the C API for interactive calls. So, here's my patch to add eval-command-interactive-spec. Seperately, how about renaming advice-eval-interactive-spec to eval-interactive-spec, and obsoleting, but not removing, the old name? I guess that we'd also want to move it to subr.el; this is no promotion, so far as I can tell, because nadvice.el is preloaded. -- Sean Whitton --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-subr-x-eval-command-interactive-spec-New-function.patch >From 204582a0d8a85f5e411b76609440424353eeb744 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 15 Jan 2023 10:57:30 -0700 Subject: [PATCH] * subr-x (eval-command-interactive-spec): New function. --- etc/NEWS | 5 +++++ lisp/emacs-lisp/subr-x.el | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index a2924201267..d2e6b18cadd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -184,6 +184,11 @@ compared reliably at all. This warning can be suppressed using 'with-suppressed-warnings' with the warning name 'suspicious'. +--- +** New function 'eval-command-interactive-spec' in the subr-x library. +This function evaluates a command's interactive form and returns the +resultant list. + * Changes in Emacs 30.1 on Non-Free Operating Systems diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 8cdbdf1ef6a..0c52e5c25e9 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -488,6 +488,13 @@ emacs-etc--hide-local-variables (progn (forward-line -1) (point)) (point-max))))) +(defun eval-command-interactive-spec (command) + "Evaluate COMMAND's interactive form and return resultant list. +If COMMAND has no interactive form, return nil." + (advice-eval-interactive-spec + (cadr (or (and (symbolp command) (get command 'interactive-form)) + (interactive-form command))))) + (provide 'subr-x) ;;; subr-x.el ends here -- 2.30.2 --=-=-=--