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, 23 Feb 2023 10:36:45 +0200 Organization: LINKOV.NET Message-ID: <86ttzckaxm.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> <868rgxea6c.fsf@mail.linkov.net> <875ybz2jiw.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="10409"; 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 23 10:12:31 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 1pV7eQ-0002WX-Ou for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Feb 2023 10:12:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pV7e0-0002cj-HJ; Thu, 23 Feb 2023 04:12: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 1pV7dy-0002cb-JL for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 04:12:02 -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 1pV7dy-0004LR-B9 for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 04:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pV7dx-0001Ty-Pv for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 04:12:01 -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, 23 Feb 2023 09:12:01 +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.16771434925661 (code B ref 61479); Thu, 23 Feb 2023 09:12:01 +0000 Original-Received: (at 61479) by debbugs.gnu.org; 23 Feb 2023 09:11:32 +0000 Original-Received: from localhost ([127.0.0.1]:32914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pV7dU-0001TF-3J for submit@debbugs.gnu.org; Thu, 23 Feb 2023 04:11:32 -0500 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:59575) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pV7dR-0001Sz-JU for 61479@debbugs.gnu.org; Thu, 23 Feb 2023 04:11:30 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id E1399E000C; Thu, 23 Feb 2023 09:11:19 +0000 (UTC) In-Reply-To: <875ybz2jiw.fsf@gmail.com> (Fernando de Morais's message of "Sat, 18 Feb 2023 10:24:55 -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:256426 Archived-At: > This patch fixes the problem when we hit C-j to select a candidate, but > the problem persists if we type multiple C-M-i when in the candidate > list, unfortunately. Thanks for finding another way to reproduce the problem. This shows that C-M-i bound to icomplete-force-complete needs the same treatment: diff --git a/lisp/icomplete.el b/lisp/icomplete.el index f7a91599f3b..b0b55dd1e7e 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))) @@ -223,7 +227,11 @@ icomplete-force-complete "Complete the icomplete minibuffer." (interactive) ;; We're not at all interested in cycling here (bug#34077). - (minibuffer-force-complete nil nil 'dont-cycle)) + (if (window-minibuffer-p) + (minibuffer-force-complete nil nil 'dont-cycle) + (minibuffer-force-complete (icomplete--field-beg) + (icomplete--field-end) + 'dont-cycle))) ;; Apropos `icomplete-scroll', we implement "scrolling icomplete" ;; within classic icomplete, which is "rotating", by contrast.