From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Current mode command discovery Date: Mon, 22 Feb 2021 05:00:17 +0100 Message-ID: <87y2fg7nvy.fsf@gnus.org> References: <87v9aubm96.fsf@gnus.org> <87wnv8xlqa.fsf@gnus.org> <838s7o9g90.fsf@gnu.org> <87im6revhq.fsf@tcd.ie> <83im6r98qd.fsf@gnu.org> <87k0r7uade.fsf@gnus.org> <83eehf978r.fsf@gnu.org> <87ft1vu9hd.fsf@gnus.org> <838s7n95pf.fsf@gnu.org> <8735xvu7sx.fsf@gnus.org> <834kib94ha.fsf@gnu.org> <874kibh9mu.fsf@telefonica.net> <83o8gi7lh2.fsf@gnu.org> <871rdebmmh.fsf@telefonica.net> <831rdc4epn.fsf@gnu.org> <87o8ggte2j.fsf@gnus.org> <875z2mq3s4.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8894"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: ofv@wanadoo.es, chad , EMACS development team , Eli Zaretskii , Richard Stallman To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 22 05:01:17 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 1lE2PN-0002DF-36 for ged-emacs-devel@m.gmane-mx.org; Mon, 22 Feb 2021 05:01:17 +0100 Original-Received: from localhost ([::1]:56412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE2PM-00009E-1U for ged-emacs-devel@m.gmane-mx.org; Sun, 21 Feb 2021 23:01:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE2Oc-00084r-VA for emacs-devel@gnu.org; Sun, 21 Feb 2021 23:00:30 -0500 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:60712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE2OZ-0006kg-L1; Sun, 21 Feb 2021 23:00:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xEfnUPoEjuCBc0ysca1rR0lD5co6YidcMvwBmLyQQwY=; b=dim1ABCGdTo1ER2JIzbSXkCKjI /hdE7XvHkT44a1ZrvBgnTymmnrcyMhR9fQ/+8uoX5I/3jTVi3bnuxfJ332ttLSG1DoF6Gj304LdOS t7jwfD2HVX+74L1xGWgpfmh3fC/51rbwO7/T1yBq8M5PQiNb0lC3oILY3g0hcjgA8qcg=; Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lE2OS-0008Nv-Vo; Mon, 22 Feb 2021 05:00:23 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAJ1BMVEUGBgUuLi1OTk1w cG+urq3Cwb+QkI/Pz88fHx7z8/NAPz6Af37///+s82SmAAAAAWJLR0QMgbNRYwAAAAd0SU1FB+UC FgMmFF6tkrIAAAGjSURBVDjLvZNNT8JAEIan1ZANJyracGQpIt7aioi3CgvKTROj4abYkBAvKsTS WykGe/UruDf9p24RpLvFm3FOb+fJzM68kwL8ayiyuTS/Ymj1g2WgpJVJ34vnZbJOiKPHwUN/t+64 d1ONomDL7ZJGpzbVXMMmda1kMV6AWpRaNknFCpBLabWNL8QCkCiltU7bAuRlOJBk4Lbf1AEZRX4N Bt4371mp6cVaPYViXEkJwKHPoTAxl0d5x52CETb4AvvcpS9MlO0Kb9Va3aW90Mp2wIPRtUPPABK1 QHB+IzehjRSsF8WLqGPq1nRID4U8GquT1okFYywCWXtr3ZQgUcwKxMs1moNEr9S5EE+LdroDUO22 IgLwu8cAmlmJAWnfAkgbmRiA7aMQfAIEwpKPDPg4E7BQOF8SIVC+Hw+iRGaTqoa/mBOGciXsinSA QgRg7TDf88OFPR4MOzY2pdkHAz8TSa/lqjnfV4sAyO9dGqmZTkdajfBOujy/zwgvDsL+F0JOZ6ZK EUd89UrJKfPOUTNW+zbRYUnIWiGXXQYAZeCX+IC/iC8a5WK1QBmjMAAAACV0RVh0ZGF0ZTpjcmVh dGUAMjAyMS0wMi0yMlQwMzozODoyMCswMDowMElG/CEAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEt MDItMjJUMDM6Mzg6MjArMDA6MDA4G0SdAAAAAElFTkSuQmCC X-Now-Playing: Demdike Stare's _Symbiosis_: "Jannisary" In-Reply-To: (Stefan Monnier's message of "Sat, 20 Feb 2021 09:36:43 -0500") Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org 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, RCVD_IN_DNSWL_NONE=-0.0001, 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:265455 Archived-At: Stefan Monnier writes: > It makes sense for M-x to "not list it at all" yet for the menu bar to > still show it (as greyed out) because the circumstances are different > (the fact that the entry is present in the menu is proof that the > command is sometimes relevant, just not currently). Thinking about this some more, I think the `menu-enable' thing is about a different thing than the completion predicate. But it is something we could be exploring doing something about, because it seems like there's an opportunity to do some cleanup in this area. The issue is: We have a bunch of commands that are available in most modes, but that can't be executed "right now" -- you have to do something else for them to become enabled. I think it would be a mistake to filter these out in any way -- that would just hinder command discovery. But we have this information spread out over a range of mechanisms today. * The `menu-enable' symbol property -- a predicate that says whether the command is useable * The :enable thing in menu items * Some thing in tool bars, I think? * `disabled' in the symbol * In the code itself * "*" in `interactive' specs And probably more. All of these are ways to say that the command exists, but can't be executed right now. We could introduce one new mechanism that replaces all this spread-out information in one place, where it belongs: (defun kill-region (...) (declare (inhibited (lambda () (and (not (region-active-p)) "The region is not active")))) ...) Or something along those lines. This predicate could be used in the menu/tool bar, and also in `M-x TAB' listings -- it would list `kill-region', but say (Inhibited: The region is not active")) afterwards, or something like that. (So the `inhibited' predicate would return a string that explains why the command isn't usable right now.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no