From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#34116: 27.0.50; minibuffer-force-complete-and-exit mostly broken Date: Fri, 18 Jan 2019 13:28:39 +0000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1547819364 21691 195.159.176.226 (18 Jan 2019 13:49:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 Jan 2019 13:49:24 +0000 (UTC) Cc: 34116@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 18 14:49:19 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gkUWN-0005Ud-B9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Jan 2019 14:49:19 +0100 Original-Received: from localhost ([127.0.0.1]:39715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkUYT-000218-Mt for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Jan 2019 08:51:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkUCl-0007WC-0k for bug-gnu-emacs@gnu.org; Fri, 18 Jan 2019 08:29:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkUCk-0001aZ-3y for bug-gnu-emacs@gnu.org; Fri, 18 Jan 2019 08:29:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36532) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gkUCk-0001aK-0c for bug-gnu-emacs@gnu.org; Fri, 18 Jan 2019 08:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gkUCj-0004SK-Sv for bug-gnu-emacs@gnu.org; Fri, 18 Jan 2019 08:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Jan 2019 13:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 34116-submit@debbugs.gnu.org id=B34116.154781813917118 (code B ref 34116); Fri, 18 Jan 2019 13:29:01 +0000 Original-Received: (at 34116) by debbugs.gnu.org; 18 Jan 2019 13:28:59 +0000 Original-Received: from localhost ([127.0.0.1]:35813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gkUCg-0004S2-RC for submit@debbugs.gnu.org; Fri, 18 Jan 2019 08:28:59 -0500 Original-Received: from mail-qk1-f179.google.com ([209.85.222.179]:38392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gkUCe-0004Rp-BS for 34116@debbugs.gnu.org; Fri, 18 Jan 2019 08:28:57 -0500 Original-Received: by mail-qk1-f179.google.com with SMTP id m17so557790qki.5 for <34116@debbugs.gnu.org>; Fri, 18 Jan 2019 05:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Ecxxn8oPXH0VJDJJXUjl0Gf3tyIExsr98oS7uO3oEuE=; b=KMQVN9EswS9UF8ICpXl735vYJTJwouJkd5JTvJuKDPivS/qDjvWiZ7GQqoKIaoCRw8 O234W6XzpqzOHztTvAugm9ulEvGvd7mEpqUNTse0uBWeKRl3rYgZms/jYSLzQQfDbEOr OFh62iGs/KUb+6/DGseutyMtJjelfFp4nzknHhDXzoipg+3yLMkZmdiK/plWHwJbP+LL lzAQT2YwmL/Tx2BC5dVB76u/7Hkw3yVotkB/AFGT/IYlu0SRQkn2VInN86dPXHDUmkRQ 8Xb1ei8Jgh2AG7TtM8aJvKDqr+PL4eYT5sVXwaQ1W9UNh4JySkqYLZRt4ai3vQ8/WLBp RxNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Ecxxn8oPXH0VJDJJXUjl0Gf3tyIExsr98oS7uO3oEuE=; b=kFH6T88ycjz0hg0XKdSJ5xmIC7KDBm8fZnprv+CrcYwR2mJL7wHbdPWftugDj0MB9b EDVsZl6PhzB78yn43SxWUa2vFzDcSysCACj5K1IaBfPx2m1265jWVLeWsNJm+3DaC8kn bkSjnnopHj0zusUggVypvv8GKvRfVlbPu9YI1yDQYbKdH9VLN5uVtJQTi1ey9KvtlNMc 6xd1/+ZUwSRwXAuZUoqiskMXae/gtcXwWWActmPMxtqQsgMScG38q41wzZK+75lLgNfX YAh2V/6ynV+5sRAZoYYoalJihRAGvSPPdSVVcNzONBE/O6oHJy7vrQSdnCFgavZAadOc Ha6Q== X-Gm-Message-State: AJcUukfzz5uTw696cGESM3ZRF9aRENgD0ZLJkUXEPaOq0EjuKQeHOrm2 xyCZ2/m/c2vVwBRYKY88xE1jBWroXbW/4g//F6w= X-Google-Smtp-Source: ALg8bN4TvJdT5Js0VER0xqsWEkasgx2/H5rTXzHrRq6do+k5RueyFXG33PVdWE/DuvyQ0SHkBOhvd2sO7+dhamRrwZA= X-Received: by 2002:ae9:ef14:: with SMTP id d20mr15053348qkg.147.1547818130737; Fri, 18 Jan 2019 05:28:50 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154549 Archived-At: On Fri, Jan 18, 2019 at 1:09 PM Stefan Monnier w= rote: > > It seems to work most of the times, but I could swear it is > > is doing mischief in some situations (can't tell which tho). > > I can believe it. I'll try to pin it down later. > test-completion should be pretty fast (and it's called by the subsequent > completion--complete-and-exit so no matter how slow, adding a call > cannot slowdown the command by more than a factor 2x) OK, though not particularly reassuring :-) > > In other words, there is some arguably poorly chosen cons > > juggling going on in minibuffer-force-complete. My fix adds > > to that, but at least it stays within the same idiom. > > I must admit that I find your fix a bit ugly (adding an ad-hoc extra > arg, then undoing cycling depending on (and dont-cycle > completion-cycling), ...). Oh yes, no problem admitting that. It's hideous! But small enough to yield to local analysis and be easy to analyse to be safe. > Taking another look at the problem, I believe the change below is the > better option. Any objection? Yes, it elegantly fixes this bug, but complicates #34077. OTOH #34077 could be solved by your try-completion thing. But as I said I think that is unstable (or at least has much more potential to be unstablel). commit 74ff04e5cd271a238cb9bd966cdbcf9804d49386 Author: Jo=C3=A3o T=C3=A1vora Date: Tue Jan 15 16:50:40 2019 +0000 Avoid broken C-M-i cycling in icomplete-mode (bug#34077) If there is only one propective candidate and it happens to be a directory then (1) C-M-i causes the prospects to be updated to the subfil= es of the completed directory, otherwise (2) the prospects are merely rotated. It is very hard to tell if (1) or (2) happened because the rotated prospects may look identical to the updated prospects. Therefore, in icomplete-mode, it is preferable to do (1) always, to avoid iconsistencies with the presentation of prospects in this mode. There are already facilities in place to rotate the prospects list. * lisp/icomplete.el (icomplete-minibuffer-map): Bind C-M-i to icomplete-force-complete. (icomplete-force-complete): New command. The current fix I have for it is (defvar icomplete-minibuffer-map (let ((map (make-sparse-keymap))) - (define-key map [?\M-\t] 'minibuffer-force-complete) + (define-key map [?\M-\t] 'icomplete-force-complete) (define-key map [?\C-j] 'icomplete-force-complete-and-exit) (define-key map [?\C-.] 'icomplete-forward-completions) (define-key map [?\C-,] 'icomplete-backward-completions) map) "Keymap used by `icomplete-mode' in the minibuffer.") +(defun icomplete-force-complete () + "Complete the minibuffer. +Like `minibuffer-force-complete', but don't cycle." + (interactive) + ;; FIXME: it _could_ make sense to cycle in certain situations, by + ;; analyzing the current thing and the thing to cycle to for + ;; instance. Unfortunately that can't be done until a _very nasty + ;; hack_ in `minibuffer-force-complete' is removed. That hack uses + ;; transient maps and prevents two consecutive calls to + ;; `icomplete-force-complete'. + (minibuffer-force-complete nil nil t)) Jo=C3=A3o T=C3=A1vora