Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent <TAB> from creating directory in counsel-find-file #1716

Closed
ericdanan opened this issue Aug 15, 2018 · 4 comments

Comments

@ericdanan
Copy link
Contributor

commented Aug 15, 2018

With ivy-magic-slash-non-match-action set to ivy-magic-slash-non-match-create, if I do the following:

  1. call counsel-find-file from ~
  2. type emacs so that the only matching candidate is .emacs.d/
  3. hit TAB (ivy-partial-or-done)

then the directory ~/emacs.d/ is created and switched to, whereas I would expect to switch to directory ~/.emacs.d/ instead (I would only expect the directory ~/emacs.d/ to be created if I type emacs.d/).

Is this intentional?

Thanks.

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Aug 20, 2018

Sorry, can't reproduce. How is ivy-magic-slash-non-match-action (which I thought would be related to /) related to TAB?

And if the directory already exists (since it's a candidate), how is it created again?

@ericdanan

This comment has been minimized.

Copy link
Contributor Author

commented Aug 22, 2018

Strange, I'm able to reproduce with a clean emacs (26.1) where I only setup MELPA, install counsel, and execute:

(counsel-mode)
(setq ivy-magic-slash-non-match-action 'ivy-magic-slash-non-match-create)

Then I call counsel-find-file from ~/ in which I have a directory .emacs.d/ but not emacs.d/. In the minibuffer I type emacs and the only matching candidate is .emacs.d/. And then I hit TAB, which I also don't think would be related to ivy-magic-slash-non-match-action, but it does create the directory emacs.d/ and switches to it (to be sure, this directory emacs.d/ did not already exist and was not a candidate).

If instead of typing emacs I type mac the the newly created directory is macs.d/ instead.

My impression is that TAB completes as much as possible after the minibuffer text. Since the only matching candidate is .emacs.d/, it also completes the final slash and this seems to trigger ivy-magic-slash-non-match-action, although it shouldn't since there's a match. But I'm not sure.

Can I do anything else to understand why I get this behavior and you don't?

Thanks in advance

@abo-abo abo-abo closed this in 02537c9 Aug 22, 2018

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Aug 22, 2018

Thanks, I was able to reproduce after your explanation. Please test.

@ericdanan

This comment has been minimized.

Copy link
Contributor Author

commented Aug 22, 2018

It works as expected now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.