From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.devel Subject: Re: Smarter M-x that filters on major-mode Date: Thu, 11 Feb 2021 09:40:19 +0100 Message-ID: <20210211084019.GA9835@tuxteam.de> References: <8ed9b43502ae1480e06b@heytings.org> <83r1lohqoc.fsf@gnu.org> <87wnvfenry.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fdj2RfSjLxBAspz7" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34735"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 11 09:41:38 2021 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 1lA7Xe-0008yG-3k for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Feb 2021 09:41:38 +0100 Original-Received: from localhost ([::1]:34084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lA7Xd-0002DY-4E for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Feb 2021 03:41:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lA7WX-0001Fq-5W for emacs-devel@gnu.org; Thu, 11 Feb 2021 03:40:29 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:58661) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1lA7WQ-00089m-ET for emacs-devel@gnu.org; Thu, 11 Feb 2021 03:40:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=YhMOPfECHUmpl7G9yCF/HGSw69bOeCF4bNNx8m9qnjM=; b=O6TbMJXMdjOrbv0Z/uoznRBHGWxXoBJv8TtLLxU0edpQR/gUrpDXJAL1h64hzjbl0HK9pBUIpmSYwwWsXAhY0blkxyyyYa2pYkRlIFinRvbTcyW0o+1wwoHukNmvDdehE+db+ogHtv44Wd1iSqKoFGluUCsYsHEgWQ8y7gCyw/nZTPi5rl10y+6x6nk4bnzqTwHdVRbRQbF321ckTWJFi1w/VrgNulinBxiyKJU7pNQNWZiCTNz28rxJmq3i3jDYUAr21QhlSIMZG6xB34BxZs8YnA7XoGB0CqtB3TShVrUpPsQ1uH0yhVX4uARuOHRMdCElhSS+IW4MlT+9oBly8Q==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1lA7WN-0002oq-Ne for emacs-devel@gnu.org; Thu, 11 Feb 2021 09:40:19 +0100 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.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, SPF_HELO_NONE=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.23 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" Xref: news.gmane.io gmane.emacs.devel:264360 Archived-At: --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 10, 2021 at 08:50:10PM -0600, Stefan Kangas wrote: > Lars Ingebrigtsen writes: >=20 > > Matt Armstrong writes: > > > >> What if instead help showed all the interactive commands provided by > >> the mode? What if M-x were smarter about highlighting mode specific > >> commands? > > > > It's been discussed before -- somebody just has to implement one of the > > various possibilities here. The problem is that commands are only tied > > very loosely to modes: > > > > (defun foo-thing () > > (interactive) > > ...) > > > > will make `M-x fTAB' show `foo-thing' even if it's useless outside of > > all other modes than `foo-mode'. Conversely, `C-h m' in `foo-mode' > > won't, as you mention, list `foo-thing' unless there's a binding for it. > > > > My suggestion is to introduce a new form: > > > > (defun foo-thing () > > (command foo-mode) > > ...) > > > > This would be just like `interactive', but will do the right thing in > > `M-x fTAB' and `C-h m' in modes derived from `foo-mode'. (It could also > > be a list of mode, of course, but that'd be more rare, is my guess.) >=20 > It would indeed be very useful to provide a mechanism to exclude > commands from M-x that are useless outside of their major mode. Nobody uses M-x in an explorative way? IMO this is a bad idea for discoverability. What is (and what is not) relevant to a mode is necessarily subject to a judgement call by someone. Some thought needs to go into how give users a way to escape that confinement, I think. Cheers - t --fdj2RfSjLxBAspz7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAmAk7XMACgkQBcgs9XrR2kYeYACfexU4rKjhhLVLgw1qbXgEGO+k VAsAn0GccD0kY246wI/tqq3y6ohEDpMU =w5Ha -----END PGP SIGNATURE----- --fdj2RfSjLxBAspz7--