From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#61479: 28.2; icomplete-in-buffer --- Error in post-command-hook: args-out-of-range Date: Thu, 16 Feb 2023 20:29:15 +0200 Organization: LINKOV.NET Message-ID: <868rgxea6c.fsf@mail.linkov.net> References: <87y1p1wr4m.fsf@gmail.com> <86cz6dfnyu.fsf@mail.linkov.net> <87wn4ltpg0.fsf@gmail.com> <87lel0ao9z.fsf@gmail.com> <86wn4k14pt.fsf@mail.linkov.net> <87y1p0dovd.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32676"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 61479@debbugs.gnu.org To: Fernando de Morais Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 16 19:31:22 2023 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 1pSj2O-0008Hv-Rs for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Feb 2023 19:31:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSj29-0005xd-F3; Thu, 16 Feb 2023 13:31:05 -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 1pSj27-0005vv-6X for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 13:31:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSj26-0000iW-UL for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 13:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSj26-0003TK-Dp for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 13:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Feb 2023 18:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61479 X-GNU-PR-Package: emacs Original-Received: via spool by 61479-submit@debbugs.gnu.org id=B61479.167657226113339 (code B ref 61479); Thu, 16 Feb 2023 18:31:02 +0000 Original-Received: (at 61479) by debbugs.gnu.org; 16 Feb 2023 18:31:01 +0000 Original-Received: from localhost ([127.0.0.1]:37651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSj25-0003T5-Fo for submit@debbugs.gnu.org; Thu, 16 Feb 2023 13:31:01 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:55369) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSj22-0003Sq-Mt for 61479@debbugs.gnu.org; Thu, 16 Feb 2023 13:31:00 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 558361C0004; Thu, 16 Feb 2023 18:30:50 +0000 (UTC) In-Reply-To: <87y1p0dovd.fsf@gmail.com> (Fernando de Morais's message of "Tue, 14 Feb 2023 16:32:38 -0300") 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:255831 Archived-At: >> Does it also select a completion candidate? > > Well, when I hit C-j, it selects the candidate, but then: > > - The buffer is modified in a way that only the selected candidate is > visible; > - The same is true for multiple C-M-i when in the candidate list; > - I need to use `undo' to go back to the previous state of the buffer. Here is a short patch that completely fixes this problem. But probably it's too late for the release branch since icomplete never worked correctly in the buffer. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index f7a91599f3b..aadc2e32787 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -215,7 +215,11 @@ icomplete-force-complete-and-exit ;; calculated, This causes the first cached completion to ;; be taken (i.e. the one that the user sees highlighted) completion-all-sorted-completions) - (minibuffer-force-complete-and-exit) + (if (window-minibuffer-p) + (minibuffer-force-complete-and-exit) + (minibuffer-force-complete (icomplete--field-beg) + (icomplete--field-end) + 'dont-cycle)) ;; Otherwise take the faster route... (minibuffer-complete-and-exit)))