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#50470: 27.1; 'company-mode' 'eshell' Date: Tue, 25 Jan 2022 18:05:59 -0500 Message-ID: References: <87h7evegav.fsf@debian-BULLSEYE-live-builder-AMD64> <154bd0e9-2779-5a28-5587-a845a982e39f@yandex.ru> <815516d6-262b-4ef1-786e-ec5b4199847c@yandex.ru> <01845bee-7637-76f6-2e86-2e2de91f6f6e@yandex.ru> 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="12598"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Christophe , 50470@debbugs.gnu.org, Dmitry Gutov To: John Wiegley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 26 00:07:30 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 1nCUuP-00033w-VQ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Jan 2022 00:07:30 +0100 Original-Received: from localhost ([::1]:48334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCUuO-00052F-IA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Jan 2022 18:07:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCUty-00050h-Fu for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2022 18:07:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57569) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nCUty-0005IM-3n for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2022 18:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nCUtx-0005YJ-Uv for bug-gnu-emacs@gnu.org; Tue, 25 Jan 2022 18:07:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jan 2022 23:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50470 X-GNU-PR-Package: emacs Original-Received: via spool by 50470-submit@debbugs.gnu.org id=B50470.164315197321270 (code B ref 50470); Tue, 25 Jan 2022 23:07:01 +0000 Original-Received: (at 50470) by debbugs.gnu.org; 25 Jan 2022 23:06:13 +0000 Original-Received: from localhost ([127.0.0.1]:50472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCUtA-0005X0-Ux for submit@debbugs.gnu.org; Tue, 25 Jan 2022 18:06:13 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:9788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCUt7-0005Wk-E2 for 50470@debbugs.gnu.org; Tue, 25 Jan 2022 18:06:11 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 64EC2805EF; Tue, 25 Jan 2022 18:06:03 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A8576804FC; Tue, 25 Jan 2022 18:06:01 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1643151961; bh=4sLLr668qOsoqYYc/n9LhyOh7vWa70pr7c6tT+LUJLk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=GuJecvtSvTjHBQN2H7kXZKyGzVOlWWTl4CdQeUAfnt2apBRvEpEo6XcqrDh5AzOth NIaJ1msZLV5sAdTXHtCHxT9UM2D/Lzp78ad3h110oMa8sypMVrZ7C1eG6hbn0NZA3V vemiy7J6Dn+bsyMhvH39+GaMtLgjB8QT2w7SaMKYtE3oROelIGXxjUumHVBac/Vryf nlHiPYpQciX03qEvKjPg4HEHQZ7+FZkRXBTy4zMkDXEZqi4XI07kqGsmsicxNhP3j5 knhAI9/2lOTn5hYJDKAQ9eBgC0/2rlJBwt6FpVm8m7cJSOpZ3TuQYL7QoFrcV5WASn 2Wf1DK1h7ZbYg== Original-Received: from pastel (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5872A1204D4; Tue, 25 Jan 2022 18:06:01 -0500 (EST) In-Reply-To: <01845bee-7637-76f6-2e86-2e2de91f6f6e@yandex.ru> (Dmitry Gutov's message of "Mon, 24 Jan 2022 03:50:59 +0200") 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:225227 Archived-At: Hi John, Could you explain to me some of the code of `pcomplete-parse-arguments`? I know that was many years ago but hopefully there's still some fond memories of how you designed it. To be honest, the only part I sort-of understand are the first 5-6 lines. Then comes the `(let ((begin (pcomplete-begin 'last)))` and after that I'm lost: it doesn't look like we're parsing arguments any more. E.g. Why/when would pcomplete-stub contain a list rather than a string? Stefan Dmitry Gutov [2022-01-24 03:50:59] wrote: > Hi Stefan, > > On 23.01.2022 05:23, Stefan Monnier wrote: >> And the 100% untested patch below is a suggestion for how to try and fix >> those kinds of bugs. >> Can someone try and maybe make it work? > > I've tried the patch, and it seems to work already, as well as fix this > particular scenario. (Thanks!) > > Might as well install it, I think. > > There is a scenario that is more noticeably broken (yet actually better with > this patch): a modification of bug#18951. Instead of > > ls * > > try > > ls ~/Docu* > > ...and [on master] the result is that the asterisk is replaced with the > "common part" of the possible completions automatically. If there is > nothing to expand with, the asterisk is similarly deleted. > > With your patch, we get the "Buffer is read-only" error in *Messages* > instead, which is probably an improvement. Because it doesn't modify the > input, nor break Company completions long-term (after the asterisk is > removed). > > The offending functions is pcomplete-parse-arguments. There is some complex > global state going on there, but the following addition seems to fix the > problem: > > @@ -790,6 +804,9 @@ pcomplete-parse-arguments > (common-stub (car completions)) > (c completions) > (len (length common-stub))) > + (unless pcomplete-allow-modifications > + (setq pcomplete-stub (buffer-substring begin (point))) > + (throw 'pcomplete-completions completions)) > (while (and c (> len 0)) > (while (and (> len 0) > (not (string= > > > Not sure if this new value of pcomplete-stub is always TRT, but it has > passed a bunch of my experiments successfully.