From unknown Mon Jun 23 02:21:34 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#17545 <17545@debbugs.gnu.org> To: bug#17545 <17545@debbugs.gnu.org> Subject: Status: 24.4.50; icomplete conflicts with minibuffer default Reply-To: bug#17545 <17545@debbugs.gnu.org> Date: Mon, 23 Jun 2025 09:21:34 +0000 retitle 17545 24.4.50; icomplete conflicts with minibuffer default reassign 17545 emacs submitter 17545 Dan McKinley severity 17545 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed May 21 12:07:42 2014 Received: (at submit) by debbugs.gnu.org; 21 May 2014 16:07:42 +0000 Received: from localhost ([127.0.0.1]:55507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wn93M-00019b-If for submit@debbugs.gnu.org; Wed, 21 May 2014 12:07:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38629) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wn8cu-0007ZE-1q for submit@debbugs.gnu.org; Wed, 21 May 2014 11:40:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wn8cn-0001N2-MJ for submit@debbugs.gnu.org; Wed, 21 May 2014 11:40:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn8cn-0001Mx-KK for submit@debbugs.gnu.org; Wed, 21 May 2014 11:40:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn8cj-00035Z-La for bug-gnu-emacs@gnu.org; Wed, 21 May 2014 11:40:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wn8cf-0001CO-Or for bug-gnu-emacs@gnu.org; Wed, 21 May 2014 11:40:09 -0400 Received: from mail-ob0-x22a.google.com ([2607:f8b0:4003:c01::22a]:48052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn8cf-00017o-6O for bug-gnu-emacs@gnu.org; Wed, 21 May 2014 11:40:05 -0400 Received: by mail-ob0-f170.google.com with SMTP id uy5so2330752obc.15 for ; Wed, 21 May 2014 08:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=DkkYwCwBEvUEJxANVz2Vf0JRI7MsiLR50u7HtG3eHRE=; b=AOyYvH0eEfJ6lvKmbjcxSB6RPNei2ymD5ai0Dg7J6avZKcJjOZ7Bp04CFJ8LKTiOBm aJKuZV+vNgIEx+RQ9D9eHzwXtbBCM4BFCFuf8GXhuxic/qP2ptu0nLfQIMMH/K/l4ntL ZgDpAgRKce70m3tZi4oeQmisr7mWpc0iDcB5QvLZwu7OkPcV1vBz75S+fX5exVHNqzau panJr3rv/VZmT+TcptuZGnI/aH22c3bgD94O9j8VOUk9LVJMDWMCJY+O5v/C7SsGlP1/ WoC6w5qnKiQ/Ex2DGJ0WMJZCmR2iipCDsfHA8fcE3BozFEhVjWeGmQyFEbsSRtX9ugtZ awoA== MIME-Version: 1.0 X-Received: by 10.182.99.198 with SMTP id es6mr20026236obb.69.1400686803954; Wed, 21 May 2014 08:40:03 -0700 (PDT) Received: by 10.76.19.115 with HTTP; Wed, 21 May 2014 08:40:03 -0700 (PDT) Date: Wed, 21 May 2014 08:40:03 -0700 Message-ID: Subject: 24.4.50; icomplete conflicts with minibuffer default From: Dan McKinley To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=089e01538dfa6434b604f9eacfa1 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 21 May 2014 12:07:39 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --089e01538dfa6434b604f9eacfa1 Content-Type: text/plain; charset=UTF-8 When completing in the minibuffer using icomplete-mode, an invisible completion can circumvent the minibuffer's default selection. For example, say you have icomplete enabled, and you try to kill the current buffer. The minibuffer will show a confirmation message like, "Kill buffer (default: foo)". If you type C-j to trigger icomplete without having actually typed any characters, icomplete will terminate an unrelated buffer and won't even tell you which it was. It will terminate whatever buffer it decides is the completion of nothing at that time. This is confusing because the minibuffer prompt suggests a completely different default. Here's a function that fixes the behavior: (defun icomplete-complete-or-default () (interactive) (let* ((start (minibuffer-prompt-end)) (end (point-max)) (phrase (buffer-substring start end))) (if (zerop (length phrase)) ; Select the minibuffer's default if there's no text after ; the prompt. (minibuffer-complete-and-exit) ; Select icomplete's default completion if the user has typed ; something. (minibuffer-force-complete-and-exit)) )) Then remapping C-j to call that in the icomplete keymap fixes the bug: (defvar icomplete-minibuffer-map (let ((map (make-sparse-keymap))) (define-key map [?\M-\t] 'minibuffer-force-complete) - (define-key map [?\C-j] 'minibuffer-force-complete-and-exit) + (define-key map [?\C-j] 'icomplete-complete-or-default) (define-key map [?\C-.] 'icomplete-forward-completions) (define-key map [?\C-,] 'icomplete-backward-completions) map) "Keymap used by `icomplete-mode' in the minibuffer.") I came across this trying to remap icomplete to instead of C-j so that the keys are more like the (apparently dead) iswitchb. That doesn't seem like an unreasonable thing to do, although I don't know how many people used iswitchb. --089e01538dfa6434b604f9eacfa1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
When completing in the minibuffer using icomplete-mod= e, an invisible
completion can circumvent the minibuffer's de= fault selection.

For example, say you have icomple= te enabled, and you try to kill the
current buffer. The minibuffer will show a confirmation message like,<= /div>
"Kill buffer (default: foo)". If you type C-j to trigge= r icomplete
without having actually typed any characters, icomple= te will terminate
an unrelated buffer and won't even tell you which it was. It will<= /div>
terminate whatever buffer it decides is the completion of nothing= at
that time.

This is confusing because= the minibuffer prompt suggests a completely
different default. Here's a function that fixes the behavior:

(defun icomplete-complete-or-default ()
=C2= =A0 (interactive)
=C2=A0 (let* ((start (minibuffer-prompt-end))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(end (point-max))
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(phrase (buffer-substring start end)))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 (if (zerop (length = phrase))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ; Select the minibuffer'= s default if there's no text after
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ; the prompt.
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (minibuffer-complete-and-exit)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0=C2=A0
=C2=A0 =C2=A0 =C2=A0 ; Select icomplete's defaul= t completion if the user has typed
=C2=A0 =C2=A0 =C2=A0 ; somethi= ng.
=C2=A0 =C2=A0 =C2=A0 (minibuffer-force-complete-and-exit))
=C2=A0 ))

Then remapping C-j to call that in = the icomplete keymap fixes the bug:

=C2=A0(defvar = icomplete-minibuffer-map
=C2=A0 =C2=A0(let ((map (make-sparse-key= map)))
=C2=A0 =C2=A0 =C2=A0(define-key map [?\M-\t] 'minibuffer-force-complete= )
- =C2=A0 =C2=A0(define-key map [?\C-j] =C2=A0'minibuffer-fo= rce-complete-and-exit)
+ =C2=A0 =C2=A0(define-key map [?\C-j] =C2= =A0'icomplete-complete-or-default)
=C2=A0 =C2=A0 =C2=A0(define-key map [?\C-.] =C2=A0'icomplete-forwa= rd-completions)
=C2=A0 =C2=A0 =C2=A0(define-key map [?\C-,] =C2= =A0'icomplete-backward-completions)
=C2=A0 =C2=A0 =C2=A0map)<= /div>
=C2=A0 =C2=A0"Keymap used by `icomplete-mode' in the min= ibuffer.")

I came across this trying to remap icomplete to <ret= urn> instead of C-j
so that the keys are more like the (appare= ntly dead) iswitchb. That
doesn't seem like an unreasonable t= hing to do, although I don't know how
many people used iswitchb.

--089e01538dfa6434b604f9eacfa1-- From debbugs-submit-bounces@debbugs.gnu.org Wed May 21 13:53:05 2014 Received: (at 17545) by debbugs.gnu.org; 21 May 2014 17:53:05 +0000 Received: from localhost ([127.0.0.1]:55555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnAhM-0005cl-Ho for submit@debbugs.gnu.org; Wed, 21 May 2014 13:53:05 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:6240) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnAhJ-0005c9-SK for 17545@debbugs.gnu.org; Wed, 21 May 2014 13:53:02 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYGAIDvNVPO+KQe/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIwULCzQSFBgNJIgECNIZF456B4Q4BKkZgWqDTCE X-IPAS-Result: ArYGAIDvNVPO+KQe/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIwULCzQSFBgNJIgECNIZF456B4Q4BKkZgWqDTCE X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="63548551" Received: from 206-248-164-30.dsl.teksavvy.com (HELO pastel.home) ([206.248.164.30]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 21 May 2014 13:52:56 -0400 Received: by pastel.home (Postfix, from userid 20848) id D9DA1601F5; Wed, 21 May 2014 13:52:55 -0400 (EDT) From: Stefan Monnier To: Dan McKinley Subject: Re: bug#17545: 24.4.50; icomplete conflicts with minibuffer default Message-ID: References: Date: Wed, 21 May 2014 13:52:55 -0400 In-Reply-To: (Dan McKinley's message of "Wed, 21 May 2014 08:40:03 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 17545 Cc: 17545@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > "Kill buffer (default: foo)". If you type C-j to trigger icomplete > without having actually typed any characters, icomplete will terminate > an unrelated buffer and won't even tell you which it was. Good point. > This is confusing because the minibuffer prompt suggests a completely > different default. Here's a function that fixes the behavior: I think a better fix is to change icomplete such that if the default is among the possible completions, then it appears first. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat May 31 22:25:34 2014 Received: (at 17545-done) by debbugs.gnu.org; 1 Jun 2014 02:25:34 +0000 Received: from localhost ([127.0.0.1]:39310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WqvSo-0007AN-34 for submit@debbugs.gnu.org; Sat, 31 May 2014 22:25:34 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:45266) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WqvSl-0007A7-Rl for 17545-done@debbugs.gnu.org; Sat, 31 May 2014 22:25:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYGAIDvNVPO+IOj/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIxALNBIUGA0kiAQI0hkXjnoHhDgBA6kZgWqDTCE X-IPAS-Result: ArYGAIDvNVPO+IOj/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIxALNBIUGA0kiAQI0hkXjnoHhDgBA6kZgWqDTCE X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="65210314" Received: from 206-248-131-163.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([206.248.131.163]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 31 May 2014 22:25:26 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 1D520AE0BC; Sat, 31 May 2014 22:25:26 -0400 (EDT) From: Stefan Monnier To: Dan McKinley Subject: Re: bug#17545: 24.4.50; icomplete conflicts with minibuffer default Message-ID: References: Date: Sat, 31 May 2014 22:25:26 -0400 In-Reply-To: (Stefan Monnier's message of "Wed, 21 May 2014 13:52:55 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 17545-done Cc: 17545-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> This is confusing because the minibuffer prompt suggests a completely >> different default. Here's a function that fixes the behavior: > I think a better fix is to change icomplete such that if the default is > among the possible completions, then it appears first. In the end I installed patch following the same idea as yours (but folded into minibuffer-force-complete-and-exit). Thank you. Stefan From unknown Mon Jun 23 02:21:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 29 Jun 2014 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Sat May 16 22:00:26 2015 Received: (at control) by debbugs.gnu.org; 17 May 2015 02:00:26 +0000 Received: from localhost ([127.0.0.1]:47557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YtnsP-0006xi-Sj for submit@debbugs.gnu.org; Sat, 16 May 2015 22:00:26 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:20179) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YtnsN-0006wl-Mn for control@debbugs.gnu.org; Sat, 16 May 2015 22:00:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlEFAGvvdVTO+LMW/2dsb2JhbAA3gVOIDJljgQQEghU9ciYYDRgElDeVdYxrAQEBAQEBAQEBgz0DA0+DHgSjY4RY X-IPAS-Result: AlEFAGvvdVTO+LMW/2dsb2JhbAA3gVOIDJljgQQEghU9ciYYDRgElDeVdYxrAQEBAQEBAQEBgz0DA0+DHgSjY4RY X-IronPort-AV: E=Sophos;i="5.11,557,1422939600"; d="scan'208";a="120273450" Received: from 206-248-179-22.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([206.248.179.22]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 May 2015 22:00:19 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id D9CECAE122; Sat, 16 May 2015 22:00:17 -0400 (EDT) From: Stefan Monnier To: control@debbugs.gnu.org Subject: blabla Message-ID: Date: Sat, 16 May 2015 22:00:17 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) unarchive 17545 From unknown Mon Jun 23 02:21:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 14 Jun 2015 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator