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#34070: 27.0.50; icomplete-mode candidate cycling broken for C-x C-f Date: Thu, 17 Jan 2019 14:20:38 +0000 Message-ID: References: <83h8ebdy61.fsf@gnu.org> <83d0ozdwfz.fsf@gnu.org> <83a7k3dto5.fsf@gnu.org> <4dd122fb-61b5-4605-9290-bde726598907@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1547734752 26091 195.159.176.226 (17 Jan 2019 14:19:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 17 Jan 2019 14:19:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) Cc: monnier@iro.umontreal.ca To: 34070@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 17 15:19:08 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 1gk8Ve-0006df-Nh for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Jan 2019 15:19:06 +0100 Original-Received: from localhost ([127.0.0.1]:45797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk8Xl-0001UG-MS for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Jan 2019 09:21:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk8Xb-0001SX-Ej for bug-gnu-emacs@gnu.org; Thu, 17 Jan 2019 09:21:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gk8XZ-0008Rq-Go for bug-gnu-emacs@gnu.org; Thu, 17 Jan 2019 09:21:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35020) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gk8XX-0008J9-4T for bug-gnu-emacs@gnu.org; Thu, 17 Jan 2019 09:21:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gk8XV-0003fE-Rw for bug-gnu-emacs@gnu.org; Thu, 17 Jan 2019 09:21: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: Thu, 17 Jan 2019 14:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34070 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 34070-submit@debbugs.gnu.org id=B34070.154773485114061 (code B ref 34070); Thu, 17 Jan 2019 14:21:01 +0000 Original-Received: (at 34070) by debbugs.gnu.org; 17 Jan 2019 14:20:51 +0000 Original-Received: from localhost ([127.0.0.1]:34301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gk8XJ-0003ei-Ph for submit@debbugs.gnu.org; Thu, 17 Jan 2019 09:20:51 -0500 Original-Received: from mail-wr1-f41.google.com ([209.85.221.41]:35927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gk8XH-0003eV-PG for 34070@debbugs.gnu.org; Thu, 17 Jan 2019 09:20:48 -0500 Original-Received: by mail-wr1-f41.google.com with SMTP id u4so11212215wrp.3 for <34070@debbugs.gnu.org>; Thu, 17 Jan 2019 06:20:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=zFNfFEiXPGEzPaPMia4demDIdr4v/TB92UNrrL7mIsA=; b=SGusHLfEaqp9nj/Kv0+C+hiTU1uO6kU1afLrIhKcWfUZEej+UgxN0rCnSjSobaxe8S P81jgnFYMW7GYQvaH1tAkVJNspp84lTSNsQaLk6GrzeB28DGTL5DE/Q1MnRSzkJraaVj fM/+D9q3zKTqNEvpj41nVOfJ8Udvwn996PgKqeYHPtJFHcUm5PPG1U8Azsw8dC9ulrpn LGiLkVa2KQnl85wDJvr0oxKzDEi5bLiH9hWiBjM89ghcR2Lvy4XnAYmjSefncXhkkWlp PK67Jff76IpUwQszUm/A/SrE+ieu6NHSNlrOMzMGC8H4wQhU2SbwiI/DkoewumpM/JNU V3/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=zFNfFEiXPGEzPaPMia4demDIdr4v/TB92UNrrL7mIsA=; b=W/9GZJc+VKg/GhsN6FzFyM7MEiIwgJyNUZfEWOP514MyTmQACSmhtFa3D0N2WF6LRp ndmWUR6+Q7WPJW4N2DEzz/9ccupetyL/kQoJkfMv+v59OQNu2XrQ70YuspLjY/mzY4B8 McdTNKs335amyyjBiFLoyB8+zG0bdX0HEq/j/4R6kLBEiBNuAStFq6bxSolcat+mZY4a ntIpwOWfzi/fC2sULmgmnQ/SITipGh7IWqSaqSW4QQprIweQFoQ2DK15Bh942VtXiWN2 0s/Kbz2xJ8CUOapmv5uW99JjOFpFBcP6yIT49SlTDDP4QMa0CXmYd9Lg9snN05yb3OZJ pIVw== X-Gm-Message-State: AJcUukdiEBTtLxcNNzIdQ5ZPt61NIqOPmXyWvWEkqVhRPNIgMCP4G/rF qjNsLGsblF84moAkzbn67Q0= X-Google-Smtp-Source: ALg8bN4sbaZqtGeBd6/MSQaXgo6BHueynll8Yko+bBoQHourS8D9iFnLVL6SxCrI/Nlu/jYO62zcmA== X-Received: by 2002:adf:a357:: with SMTP id d23mr12739274wrb.195.1547734841787; Thu, 17 Jan 2019 06:20:41 -0800 (PST) Original-Received: from GONDOMAR.yourcompany.com (mail3.siscog.pt. [195.23.29.18]) by smtp.gmail.com with ESMTPSA id a62sm31237623wmf.47.2019.01.17.06.20.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jan 2019 06:20:41 -0800 (PST) In-Reply-To: <4dd122fb-61b5-4605-9290-bde726598907@default> (Drew Adams's message of "Mon, 14 Jan 2019 09:55:47 -0800 (PST)") X-Antivirus: AVG (VPS 190117-0, 17-01-2019), Outbound message X-Antivirus-Status: Clean 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:154512 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable tag 34070 patch Drew Adams writes: >> > I'd like to push the fix before that maybe, any objections? >>=20 >> Please wait for Drew to respond, before you do. > > I took a look at the bug description, reproduced it, and took a look > at the proposed patch. It looks OK to me. Thx. I've already pushed the proposed patch to master, but there's a much less intrusive way using a new patch attached after my sig. Significantly, while still honouring the original intention of Drew's change: 65797b1d7 "Make icomplete respect `completion-ignored-extensions'" the new patch does two things: 1. Still fixes the candidate cycling (i.e. this bug) =20=20=20 2. Leaves the current directory as a candidate, i.e. "./" is *not* filtered from the prospects list (but "../" is). Number 2 can be seen as "new" behaviour, but then Drew's patch also silently introduced new behaviour by filtering out "./" and "../", which are *not* in completion-ignored-extensions. Reading bug#12939 (https://debbugs.gnu.org/12939) this seems to have gone unnoticed. If someone thinks this is a problem we can make this configurable (though I think the default should be what I suggest, since it makes C-x C-f'ing directories much easier). Jo=E3o --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-Simplify-ignored-extensions-filtering-in-Icomplete-b.patch >From 99c712809fca46648a02451c4eaa8196e915207b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Tue, 15 Jan 2019 12:10:23 +0000 Subject: [PATCH 2/5] Simplify ignored extensions filtering in Icomplete (bug#34070) * lisp/icomplete.el: Use lexical binding. (icomplete--filtered-completions): Remove. (icomplete-forward-completions, icomplete-backward-completions): Revert last change. (icomplete-completions): Use minibuffer-completion-predicate to filter out completion-ignored-extensions. --- lisp/icomplete.el | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 82e2728487..6d77c0649a 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -1,4 +1,4 @@ -;;; icomplete.el --- minibuffer completion incremental feedback +;;; icomplete.el --- minibuffer completion incremental feedback -*- lexical-binding: t -*- ;; Copyright (C) 1992-1994, 1997, 1999, 2001-2019 Free Software ;; Foundation, Inc. @@ -162,9 +162,6 @@ icomplete-force-complete-and-exit (minibuffer-force-complete-and-exit) (minibuffer-complete-and-exit))) -(defvar icomplete--filtered-completions nil - "If non-nil completions as filtered by `icomplete-completions'") - (defun icomplete-forward-completions () "Step forward completions by one entry. Second entry becomes the first and can be selected with @@ -172,8 +169,7 @@ icomplete-forward-completions (interactive) (let* ((beg (icomplete--field-beg)) (end (icomplete--field-end)) - (comps (or icomplete--filtered-completions - (completion-all-sorted-completions beg end))) + (comps (completion-all-sorted-completions beg end)) (last (last comps))) (when comps (setcdr last (cons (car comps) (cdr last))) @@ -186,8 +182,7 @@ icomplete-backward-completions (interactive) (let* ((beg (icomplete--field-beg)) (end (icomplete--field-end)) - (comps (or icomplete--filtered-completions - (completion-all-sorted-completions beg end))) + (comps (completion-all-sorted-completions beg end)) (last-but-one (last comps 2)) (last (cdr last-but-one))) (when (consp last) ; At least two elements in comps @@ -373,8 +368,21 @@ icomplete-completions The displays for unambiguous matches have ` [Matched]' appended \(whether complete or not), or ` [No matches]', if no eligible matches exist." - (let* ((minibuffer-completion-table candidates) - (minibuffer-completion-predicate predicate) + (let* ((ignored-extension-re + (and minibuffer-completing-file-name + icomplete-with-completion-tables + completion-ignored-extensions + (concat "\\(?:\\`\\.\\./\\|" + (regexp-opt completion-ignored-extensions) + "\\)\\'"))) + (minibuffer-completion-table candidates) + (minibuffer-completion-predicate + (if ignored-extension-re + (lambda (cand) + (and (not (string-match ignored-extension-re cand)) + (or (null predicate) + (funcall predicate cand)))) + predicate)) (md (completion--field-metadata (icomplete--field-beg))) (comps (completion-all-sorted-completions (icomplete--field-beg) (icomplete--field-end))) @@ -385,13 +393,8 @@ icomplete-completions ;; `concat'/`mapconcat' is the slow part. (if (not (consp comps)) (progn ;;(debug (format "Candidates=%S field=%S" candidates name)) - (format " %sNo matches%s" open-bracket close-bracket)) + (format " %sNo matches%s" open-bracket close-bracket)) (if last (setcdr last nil)) - (if (and minibuffer-completing-file-name - icomplete-with-completion-tables) - (setq comps (completion-pcm--filename-try-filter comps) - icomplete--filtered-completions comps) - (setq icomplete--filtered-completions nil)) (let* ((most-try (if (and base-size (> base-size 0)) (completion-try-completion @@ -477,11 +480,11 @@ icomplete-completions (if prefix-len (substring (car comps) prefix-len) (car comps)) comps (cdr comps)) (setq prospects-len - (+ (string-width comp) - (string-width icomplete-separator) - prospects-len)) - (if (< prospects-len prospects-max) - (push comp prospects) + (+ (string-width comp) + (string-width icomplete-separator) + prospects-len)) + (if (< prospects-len prospects-max) + (push comp prospects) (setq limit t)))) (setq prospects (nreverse prospects)) ;; Decorate first of the prospects. -- 2.19.2 --=-=-=--