From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#22324: 25.0.50; completion-category-defaults style doesn't override completion-styles (gets prepended instead) Date: Wed, 26 Jan 2022 12:19:00 -0500 Message-ID: References: <868u41rv84.fsf@yandex.ru> <83fuy8p8oq.fsf@gnu.org> <568FA9D0.2040609@yandex.ru> <83egdsp88n.fsf@gnu.org> <568FABFC.3000205@yandex.ru> <87tufr74of.fsf@gnus.org> <87lf0yjwpw.fsf@gnus.org> <87r1aodus0.fsf@gnus.org> <66aa873d-5f5f-9024-efb6-e6110c27ab3a@yandex.ru> <87ilvy4m94.fsf@gnus.org> <87czklnqvs.fsf@gnus.org> <3045ca8b-f5d6-c85e-d170-3fe158fec64e@yandex.ru> <87ilu94gac.fsf@gnus.org> <43725c9f-1f0a-fb43-82a2-3f284791fdf5@yandex.ru> <875yq8ypmi.fsf@gnus.org> <184dffab-4fa4-e265-c8ef-0c088149b1b4@daniel-mendler.de> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5663"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , 22324@debbugs.gnu.org, Dmitry Gutov To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 26 18:47:42 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1nCmOU-0001Hp-36 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Jan 2022 18:47:42 +0100 Original-Received: from localhost ([::1]:55700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCmOT-0002cc-3O for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Jan 2022 12:47:41 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nClxj-0005eL-5A for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2022 12:20:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nClxi-0002YB-RZ for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2022 12:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nClxi-00066z-B7 for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2022 12:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Jan 2022 17:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22324 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 22324-submit@debbugs.gnu.org id=B22324.164321756023415 (code B ref 22324); Wed, 26 Jan 2022 17:20:02 +0000 Original-Received: (at 22324) by debbugs.gnu.org; 26 Jan 2022 17:19:20 +0000 Original-Received: from localhost ([127.0.0.1]:53358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nClx2-00065b-0u for submit@debbugs.gnu.org; Wed, 26 Jan 2022 12:19:20 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:63371) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nClx0-00065N-1G for 22324@debbugs.gnu.org; Wed, 26 Jan 2022 12:19:19 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id DAFA1100189; Wed, 26 Jan 2022 12:19:11 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A21BF10000D; Wed, 26 Jan 2022 12:19:09 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1643217549; bh=ANAyi0qarT8+RbHtwC4054aMcT7hN7oIXXs/tJ7ECxw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=D0Va7lFf2Y635NHes0a8EL0fxQy4TwnmODHjsPTgu6qLXN4/98WhaFUmyJdU/mHzy AKvAq8lPAtmQqTfDkDfyUj3/SOTkgq/3/HfTM9JTBE7j7oV57bKQay4rMFOlO6/4Kk cwyXFbLfr9TEP+35v9VX4TePl3QYpE+x4vIypbFA1EjXyVetyUlYmu9nit5dtefJQ5 X8oCRBMkmOFBdTGziX+kl0RmsDG76RbV1RmB2bFDMAmHNCKc/u6o0+l/HsPNwCZcIp 71RZx+UeJ9pJCE+aEZL4VSMmKgINQFBL+TW1y7mQYAWhXN1hd/rzy2hGdaWF3X92Vy eMrsgaRlzstig== Original-Received: from alfajor (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5E3BF1207DA; Wed, 26 Jan 2022 12:19:09 -0500 (EST) In-Reply-To: <184dffab-4fa4-e265-c8ef-0c088149b1b4@daniel-mendler.de> (Daniel Mendler's message of "Wed, 26 Jan 2022 14:49:48 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:225297 Archived-At: > This sounds like a good idea to solve the issue and retain backward > compatibility. It is like eating the cake backwards :) A `fail' > completion style is pretty trivial. It boils down to adding `(fail > ignore ignore "Fail with no completions")` to the > `completion-styles-alist`, or did I miss something? No, because `ignore` will return nil and so we'll just keep going to the next style. We need try/all-completion functions for this style to return a non-nil value but that is like "no completion". I suspect it can't be done quite right without changing `minibuffer.el`, but we can probably get close enough to be tolerable with older Emacsen. E.g. for the try-completion case, I think we can return (STRING . POINT) and for all-completions maybe returning `0` will do the trick. > I am aware of this distinction, but I chose to ignore it. Calling it > "quite different" feels like an exaggeration, given that Emacs is > supposed to be configurable throughout by the user - of course this is > only my interpretation. The users are indeed free to mess with anything they like, of course. But packages are allowed to change `completion-category-defaults` whereas they're not allowed to change `completion-category-override`. While we're here, let's not forget the other problem with `completion-category-defaults` which is when a package puts something like `substring` in it because `partial-completion` is not "good enough": this can end up taking precedence over the users's customization of the default to something like `flex` which is probably not what's wanted. I'm not completely sure how to fix that one. An cheap solution would be to allow `completion-category-defaults` to specify a function rather than a list of styles, and then this function will return the list of styles to use so it can dynamically adapt to the user's chosen default. But it's kind of a cop out because that function will need to "guess" what is the relationship between the various styles, which is the crux of the matter. This problem doesn't apply to `completion-category-override` since we can consider it to be the user's responsability to take `completion-styles` into account when setting `completion-category-override`. Stefan