From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Knut Anders Hatlen Newsgroups: gmane.emacs.bugs Subject: bug#55712: 29.0.50; Bad interaction between icomplete and completion-auto-select. Date: Mon, 30 May 2022 22:55:34 +0200 Message-ID: <87leuisptl.fsf@gmail.com> References: <87a6b0gp9g.fsf@dell.mail-host-address-is-not-set> <86a6b0un9u.fsf@mail.linkov.net> <868rqi51zv.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23669"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 55712@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 30 22:56:10 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 1nvmQs-0005un-5w for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 May 2022 22:56:10 +0200 Original-Received: from localhost ([::1]:38214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nvmQq-0001MK-S3 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 May 2022 16:56:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvmQk-0001L3-Pc for bug-gnu-emacs@gnu.org; Mon, 30 May 2022 16:56:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nvmQk-0002h8-FT for bug-gnu-emacs@gnu.org; Mon, 30 May 2022 16:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nvmQk-00045J-DQ for bug-gnu-emacs@gnu.org; Mon, 30 May 2022 16:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Knut Anders Hatlen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 May 2022 20:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55712 X-GNU-PR-Package: emacs Original-Received: via spool by 55712-submit@debbugs.gnu.org id=B55712.165394414815665 (code B ref 55712); Mon, 30 May 2022 20:56:02 +0000 Original-Received: (at 55712) by debbugs.gnu.org; 30 May 2022 20:55:48 +0000 Original-Received: from localhost ([127.0.0.1]:46158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvmQV-00044Z-JJ for submit@debbugs.gnu.org; Mon, 30 May 2022 16:55:48 -0400 Original-Received: from mail-lj1-f181.google.com ([209.85.208.181]:44931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvmQQ-00044E-QZ for 55712@debbugs.gnu.org; Mon, 30 May 2022 16:55:46 -0400 Original-Received: by mail-lj1-f181.google.com with SMTP id w23so1916262ljd.11 for <55712@debbugs.gnu.org>; Mon, 30 May 2022 13:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=HnRHK9DOgzHgcaNzX1vYXcQycQ7ZfF99fqPjkbetAK8=; b=hbNNrYlZwmfCfqk3nPYhSA7S7u/vBZ4TqrzB2xHD9bED5QoY9W7pg7V5dywPVEgoGC mrR/MOPO638+4lY2J4DeP8RQJWznfPdEjj0ayJeMsB7bG20HyCuU/uaFRpcZh8iEWNXL 3EwxY4h2Xc1EfxT6qtXckScjdddBi5qvLZZnQFumWyNmnWJytl5JHImf4fAdlJy+2PCT aweCpSGKVVtvtgl3PUtUYYBZbDKdTzl+UAonLBkrJS9BUb6dPIQINV1UVyRQVR54J6Ax kdG/J1l6joP6wwhtxhuu6pBy54US3mNG/l6uC29JEoelsHemNaLrhF9AGP0HKEP393rg g8Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=HnRHK9DOgzHgcaNzX1vYXcQycQ7ZfF99fqPjkbetAK8=; b=lmehuDqDrrtkLZ5evEqIpS0/wV7vQPeNVFL4uYp7zyGb3MHoJLl6Hfo931kig9mO9y R0V2NXDkAIxOp2N8p1RLVDuBwUZftAedubr0DNIS/XvIX/kvvXRm1ByIoE3XA+hGt8QX Hjj7rAqmxo3GUWq0+tzIherhbE7mOpQoaXhxCU65Cx9DqGLmLewCPXgr6gId6vAVpA5M elFGNzS5H/OrxHQL+4OjCA8RKCbYbk/XlpMtEwd10LwIiZ5+LGs9rqS66W/6scxDE7Ub /c+lQS/J4qhLwr5YfjfG3PAFRscGnrRyFPdfGL7VsdyzRDx+CSGumP+eoRuJvaK557jO wr/w== X-Gm-Message-State: AOAM530KeAa4abgeSSu0CBftdPwWQaeT+8ValZF/QKorMcBIvG0zy1mJ m0qnFfG4WyC1XHYKKkqlb5QpzUd/iA== X-Google-Smtp-Source: ABdhPJzqJ3lfrHTIHzVlnEtt1JWrH5OK1K+uRzASuRT0vxV+WHS23mUWeUY5bQXKPHb+r4WhcjC3HQ== X-Received: by 2002:a2e:bba2:0:b0:253:e644:61e8 with SMTP id y34-20020a2ebba2000000b00253e64461e8mr27322519lje.42.1653944136238; Mon, 30 May 2022 13:55:36 -0700 (PDT) Original-Received: from dell ([2a02:1660:692e:dd00::44c]) by smtp.gmail.com with ESMTPSA id m1-20020a2e5801000000b0025550f92c05sm561238ljb.54.2022.05.30.13.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 13:55:35 -0700 (PDT) In-Reply-To: <868rqi51zv.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 30 May 2022 20:36:28 +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" Xref: news.gmane.io gmane.emacs.bugs:233405 Archived-At: Juri Linkov writes: >>> (icomplete-mode 1) >>> (setopt completion-auto-select t) >>> C-x C-f TAB TAB >>> >>> The following error message is displayed in the minibuffer: >>> >>> Error in post-command-hook (icomplete-post-command-hook): (wrong-type-a= rgument integer-or-marker-p nil) >> >> I confirm the problem, I have seen it a few times, but >> it seems the root of the problem is in the way how buffer-local >> hooks are fired. icomplete-post-command-hook is a hook >> local in the minibuffer. But when the command switches >> from the minibuffer to the Completions buffer, then for an unknown >> reason the minibuffer post-command hook is still fired in another buffer= - >> in the Completions buffer that has no local post-command hook. > > Actually, this problem started to appear after the recent addition > of completion-auto-select that calls switch-to-completions in two > different places that fail for two different reasons. Each of both > cases messes up buffers and windows in such a way that after the end > of the command the current buffer is " *Minibuf-1*", but the selected > window is "*Completions*": > > 1. when completion-auto-select is t, minibuffer-completion-help > temporarily switches buffers using =E2=80=98(with-current-buffer-window "= *Completions*"=E2=80=99, > then display-completion-list calls completion-setup-hook and completion-s= etup-function > that uses switch-to-completions to select another window. Then > minibuffer-completion-help restores the original buffer, i.e. the minibuf= fer, > but the selected window remains "*Completions*". > > 2. when completion-auto-select is 'second-tab', completion--in-region-1 > uses =E2=80=98(with-current-buffer (window-buffer window)=E2=80=99. Then > switch-to-completions selects another window, after that > the original buffer is restored, i.e. the minibuffer, > but the selected window remains "*Completions*". > > So the solution for both cases is to move the window selection > outside from switching buffers: Thanks! The patch seems to be working fine in my setup. --=20 Knut Anders