GNU bug report logs - #55712
29.0.50; Bad interaction between icomplete and completion-auto-select.

Previous Next

Package: emacs;

Reported by: Knut Anders Hatlen <kahatlen <at> gmail.com>

Date: Sun, 29 May 2022 18:37:01 UTC

Severity: normal

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Knut Anders Hatlen <kahatlen <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 55712 <at> debbugs.gnu.org
Subject: bug#55712: 29.0.50; Bad interaction between icomplete and completion-auto-select.
Date: Mon, 30 May 2022 22:55:34 +0200
Juri Linkov <juri <at> linkov.net> 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-argument 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 ‘(with-current-buffer-window "*Completions*"’,
> then display-completion-list calls completion-setup-hook and completion-setup-function
> that uses switch-to-completions to select another window.  Then
> minibuffer-completion-help restores the original buffer, i.e. the minibuffer,
> but the selected window remains "*Completions*".
>
> 2. when completion-auto-select is 'second-tab', completion--in-region-1
> uses ‘(with-current-buffer (window-buffer window)’.  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.

-- 
Knut Anders




This bug report was last modified 2 years and 289 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.