From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Current mode command discovery Date: Wed, 17 Feb 2021 18:26:16 +0200 Message-ID: <1fb773f6-1480-53ce-08ae-1f7d0ba23428@yandex.ru> References: <87v9aubm96.fsf@gnus.org> <87czwzfn9p.fsf@telefonica.net> <87eehfnd83.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28795"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen , =?UTF-8?Q?=c3=93scar_Fuentes?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 17 17:27:25 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 1lCPfg-0007LD-Dc for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Feb 2021 17:27:24 +0100 Original-Received: from localhost ([::1]:52492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCPff-0006SR-EG for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Feb 2021 11:27:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCPeg-0005SM-OC for emacs-devel@gnu.org; Wed, 17 Feb 2021 11:26:22 -0500 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:35281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCPee-0004YU-Hl for emacs-devel@gnu.org; Wed, 17 Feb 2021 11:26:22 -0500 Original-Received: by mail-ed1-x535.google.com with SMTP id n1so6896768edv.2 for ; Wed, 17 Feb 2021 08:26:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=e5h3CXCj9JiDpoy7l8lMgtpTulIJpRfosq6lGbsukjA=; b=J8MyLqJs/kgKyBpJP+Jjug4nHrTOlPtC50LpALF7Svewn5TfytM0UDO1WyDeNxpc5t OioyLo1s30M+n/tYS/NMxjHsPpuKTsrWz65NteULq2FyJRydONtW/k2ADtjdpP9rYeey crfOvZd+4ogbf70F46QWNqpdnn8ub7fRvraQEP9Q8WKd2R6//WUKc0zYdaiWDIHjST0y csoR747gBw1QTeAYviO6D7csVFtCt4Sct56so4fcX7nlSurSoPsSIH8oV92XeRAOVRIP 96Foo4WDwbTmUZKYAqhFS87tabEwsEI/Vic2ue2yu20Y2J8tI5Qn9g0IB7y/rFJPz+7Q 1C1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=e5h3CXCj9JiDpoy7l8lMgtpTulIJpRfosq6lGbsukjA=; b=PzWohiPBCeLxT1RAJn2a9flAu2WiCEpFcF/kUY/MhAfMnYiUoMUqacTx1aTImCG/vD Nv2I/vo4clRV0AD/UZYht3VVNEiji7SX/rexWlRHSIOE3oYYIgHkEYIogk+Vvya0eq6l ZQBeKspttxyC1DzC9QUcbm42uUuBayeCt9Ua5ExLE/tBZDRtIZZXSJJJzmBLebgCK88L rCH3xmXTlDtzqyv0CXpkm/a+iKMo2VmVMEAWJp9SksMnXk6zZokFpJhDivF8MOZPW7vb UIRzJWbiTTxf0+55RVICM6wDlUTekPAj4PJHjPHDci1yBNQuOyiRgSj8HKQvNMoo36Kj 3R8A== X-Gm-Message-State: AOAM530fBoPBYSIVPeDIjh3Y9/hjCR7Bd2JqOvLMFwj5a+IMaDfaI6rQ Q/nVa1Az8pPPXatd/Lv4ZJORQZnawIk= X-Google-Smtp-Source: ABdhPJxlil8iE7WVDiCNuqt4LvCwJ8ZcHk60eKCelnIeK+1EZio4NYZQAdZ1d0B0bCnO35uYLoRgCw== X-Received: by 2002:a05:6402:541:: with SMTP id i1mr27046019edx.36.1613579178153; Wed, 17 Feb 2021 08:26:18 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id y8sm1305585edd.97.2021.02.17.08.26.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Feb 2021 08:26:17 -0800 (PST) In-Reply-To: <87eehfnd83.fsf@gnus.org> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=raaahh@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:265017 Archived-At: On 17.02.2021 13:30, Lars Ingebrigtsen wrote: > Note: THIS IS NOT A DISCUSSION ABOUT M-X. > > Óscar Fuentes writes: > >> That would be very interesting, but AFAIU with the current >> implementation it has some problems. >> >> It would miss some candidates which belong to the current mode although >> they are not marked as mode-specific because they are also applicable to >> other contexts. This would be confusing for the user. >> >> So we need a mechanism for saying `foo-bar-command' belongs to >> `foo-mode', but it is not specific of that mode. > > Yes, that's a problem. > > Hm... there's two obvious sources if information about what commands > "belong" to a mode: There's the key bindings, and then there's the new > mode tagging. We could perhaps use both in this new command? I.e., if > somebody has gone to the trouble to add a command to the keymap of the > mode, then it's probably pretty useful for that mode? If someone annotated a command with applicability conditions, we should probably combine them with 'or' (like if it has both (declare (modes ...)) and (declare (completion ...))). Having a command belong to a keymap could be a new implicit applicability condition. > A more serious problem that this brings up is the problem with > non-mode-specific predicates: They don't convey any information about > why the predicate is t/nil. Say you have > > (defun foo-spiffy-command () > (declare (predicate my-clever-predicate-p)) > (interactive)) > > When listing mode-specific commands, and this predicate returns t, > should it be included? Yes? No? There's no way of saying, really... > > So: Tagging by mode conveys more information to the system than just > having predicates, and we can use that. This also means that > > (declare (modes ...)) > > should be implemented differently than it is today (which is just > slapping a predicate onto the symbol-plist). Moving the checking logic inside the read-extended-command-predicate implementation seems logical. (declare (modes ...)) would just add a tag to the command, with natural possibility to add other tags, which a different read-extended-command-predicate could use.