unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Ole Laursen <olau@iola.dk>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	19031@debbugs.gnu.org, Andrii Kolomoiets <andreyk.mad@gmail.com>
Subject: bug#19031: 24.4; find-file in icomplete-mode shows completions with no input
Date: Tue, 08 Dec 2020 10:51:04 +0200	[thread overview]
Message-ID: <87zh2o7krj.fsf@mail.linkov.net> (raw)
In-Reply-To: <CANb2OvKD5pkrGobqNk9E6gv+ZWG3dFvb9A5oUNgbiz=syQkRLQ@mail.gmail.com> (Ole Laursen's message of "Mon, 7 Dec 2020 12:43:38 +0100")

> I originally reported this because I found it jarring to get a bunch
> of completions without having entered anything. In my home dir it
> basically shows me garbage (dot files that I'm never interested in).
>
> Would it not be possible to make a difference between the case where
> find-file provides some default text (current dir) and where I have
> entered some input? The variable literally says -on-no-input.

I tried to handle this case with the following patch, but it doesn't work
because read-file-name-default resets `minibuffer-default' to nil,
so icomplete doesn't know what was initial input in the minibuffer.

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 676917b9da..47bd8f90a4 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -579,7 +579,10 @@ icomplete-exhibit
         (goto-char (point-max))
                                         ; Insert the match-status information:
         (when (and (or icomplete-show-matches-on-no-input
-                       (> (icomplete--field-end) (icomplete--field-beg)))
+                       (if (stringp minibuffer-default)
+                           (/= (icomplete--field-end) (+ (icomplete--field-beg)
+                                                         (length minibuffer-default)))
+                         (> (icomplete--field-end) (icomplete--field-beg))))
                    (or
                     ;; Don't bother with delay after certain number of chars:
                     (> (- (point) (icomplete--field-beg))





  reply	other threads:[~2020-12-08  8:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 11:25 bug#19031: 24.4; find-file in icomplete-mode shows completions with no input Ole Laursen
2020-12-04 10:35 ` Lars Ingebrigtsen
2020-12-04 11:37   ` Andrii Kolomoiets
2020-12-06 12:46     ` Lars Ingebrigtsen
2020-12-07 11:43       ` Ole Laursen
2020-12-08  8:51         ` Juri Linkov [this message]
2020-12-08 10:43           ` Andrii Kolomoiets
2020-12-08 13:29             ` Lars Ingebrigtsen
2020-12-08 15:34             ` Eli Zaretskii
2020-12-08 16:16               ` Andrii Kolomoiets
2020-12-08 17:09                 ` Ole Laursen
2020-12-08 19:11                 ` Juri Linkov
2020-12-08 21:33                   ` Andrii Kolomoiets
2020-12-09 19:08                     ` Juri Linkov
2020-12-10  8:08                       ` Andrii Kolomoiets
2020-12-14  8:44                         ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zh2o7krj.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=19031@debbugs.gnu.org \
    --cc=andreyk.mad@gmail.com \
    --cc=larsi@gnus.org \
    --cc=olau@iola.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).