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#74420: 31.0.50; PCM completion for ~/src/emacs/trunk/*/minibuf breaks Date: Mon, 18 Nov 2024 15:39:17 -0500 Message-ID: References: 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="28738"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74420@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 18 21:40:10 2024 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 1tD8XZ-0007HV-Hi for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Nov 2024 21:40:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD8XU-00018j-FC; Mon, 18 Nov 2024 15:40:04 -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 1tD8XT-00018a-6Q for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2024 15:40:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD8XS-0001hw-Tw for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2024 15:40:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=xuea10ALchvMxlV1e3T92ZPWI/2Q9SCOIAqaAoDKjqQ=; b=ie9GXaTEafzqHhyyCVEOpGOVy6TZ2exxw/wgUl9IsiXGy7fx8Fli9JFIVfGLC1lAwAlwu8J6/4FT3/6OqzaloI4yZQMu5QrryWxxHtR0z72qA1LRq+myJ7szW75/yCsBxvH38EO4/RBX0aSQz5o8el9XuTJXTBBC0FT6jTO5oOzv0lKSkMuxLsuPmd/N89e2qmxBg6jjLBB1WdOoZO7k/wT5HVMt/FN953HMSCB42EAmtWBEF9+r2jHrtlxogowU5Ps2zVghtYaRIA73J0Y67lwXNNq3IR7gZxTNqff2WKDub8M4zKD6zwZkyR/jc8YaoicJqoVSM3MTLHQFmunvLw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tD8XS-0001NF-Bo for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2024 15:40: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: Mon, 18 Nov 2024 20:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74420 X-GNU-PR-Package: emacs Original-Received: via spool by 74420-submit@debbugs.gnu.org id=B74420.17319623725227 (code B ref 74420); Mon, 18 Nov 2024 20:40:02 +0000 Original-Received: (at 74420) by debbugs.gnu.org; 18 Nov 2024 20:39:32 +0000 Original-Received: from localhost ([127.0.0.1]:39376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tD8Wy-0001ME-Gc for submit@debbugs.gnu.org; Mon, 18 Nov 2024 15:39:32 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tD8Ww-0001M1-JF for 74420@debbugs.gnu.org; Mon, 18 Nov 2024 15:39:31 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 361A51001D9; Mon, 18 Nov 2024 15:39:24 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731962363; bh=xNjh5P2/tuodvJqs6oxi0eN9h6WRgY1BcJcXXR1G+oc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Z0lCGVsNkOABp633puSzSOsq5iRUesqyv2Pu4s/U66ZTANvgUjhJKmAnlCY6PiH5/ fy1Qn5oKcBy1Lb9a6P/HzRIwavad4q50ycnI92vT5tK1YeZrXG6SP74l0qFqPhsnJD BDwtK7QuxD6iJuRfNpdyKhOCYS0qgVqftAW5iMUvQM3r/V4Ob3DQisRWAX2a2pRnWj nFUcr3kzmEuNYGA7nglpdwTS42n4V6Qtl8Djls2b3l7G4kmHT2bB7tNNVe6vOcbVH4 NhruiX7r38ylXhmyZBTONCp+fdjcx3jUwdR0TopHPtavbuEZ650K+BwOGiRihIApbO e/nM0Q8xk3njA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4C0271000C3; Mon, 18 Nov 2024 15:39:23 -0500 (EST) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3C87A1201A2; Mon, 18 Nov 2024 15:39:23 -0500 (EST) In-Reply-To: (Spencer Baugh's message of "Mon, 18 Nov 2024 12:36:19 -0500") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295611 Archived-At: > An explicitly typed * has different semantics from automatically > inserted PCM wildcards, so it should be preserved on > try-completion. We already do this in some cases, but now we do > it more. Concretely, we do it by optimizing the PCM pattern > more aggressively to avoid having multiple wildcards in a row: > after those are removed, the existing code in > completion-pcm--merge-completions is able to preserve * in more > cases. Oh, indeed, thank you. The patch looks good to me, so if there are no objection, I'll install it in a few days (feel free to ping me if I forget). Banter follows. > * lisp/minibuffer.el (completion-pcm--optimize-pattern): Add > more optimizations. (bug#74420) Aha, so that's why you didn't submit the patch together with the initial bug report! > - (`(,(or 'any 'any-delim) ,(or 'any 'point) . ,_) > - (setq p (cdr p))) > + ;; Remove duplicate `any' and `prefix' > + (`(any any . ,rest) > + (setq p (cons 'any rest))) > + (`(prefix prefix . ,rest) > + (setq p (cons 'prefix rest))) > + ;; `any' matches anything `any-delim' does, and grows the same way. > + (`(any-delim any . ,rest) > + (setq p (cons 'any rest))) AFAICT you can still merge the `any-delim any` and `any any` cases. > + ;; Remove other wildcards found around `star' or `point'. > + ((or `(,(and keep (or 'star 'point)) ,(or 'any 'any-delim 'prefix) . ,rest) > + `(,(or 'any 'any-delim 'prefix) ,(and keep (or 'star 'point)) . ,rest)) > + (setq p (cons keep rest))) BTW, maybe we should go with something like (`(,(and (pred symbolp) s1) ,(and (pred symbolp) s2) . ,rest) (cond ((completion-pcm---p s1 s2) (setq p (cons s1 rest))) ((completion-pcm---p s2 s1) (setq p (cons s2 rest))) (t (push (pop p) n)))) Where `completion-pcm---p` is some kind of partial ordering? Stefan