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

"ivy-immediate-done" returning empty string #2165

Closed
muirdm opened this issue Jul 23, 2019 · 5 comments
Closed

"ivy-immediate-done" returning empty string #2165

muirdm opened this issue Jul 23, 2019 · 5 comments

Comments

@muirdm
Copy link
Contributor

@muirdm muirdm commented Jul 23, 2019

  1. emacs -Q -L . -l ivy.el in "swiper" project directory
  2. (ivy-mode t)
  3. (message "dir %s" (read-directory-name "Test: "))
  4. select some directory and run ivy-immediate-done (i.e. C-M-j)

For me this prints "dir " instead of "dir /whatever/you/picked".

@abo-abo abo-abo closed this in fb486d8 Jul 24, 2019
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Jul 24, 2019

Thanks. Please test and review the commit message for context.

@muirdm
Copy link
Contributor Author

@muirdm muirdm commented Jul 24, 2019

Thanks for looking. That change always returns the default directory instead of the current input. Using the above example (assuming you are in swiper project), navigate to "swiper/targets" then run ivy-immediate-done. It returns "swiper/" instead of "swiper/targets".

abo-abo added a commit that referenced this issue Jul 24, 2019
* ivy-test.el (ivy-read-directory-name): Add test.

Fixes #2165
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Jul 24, 2019

Thanks for testing. I have now added an automated test for this.

@muirdm
Copy link
Contributor Author

@muirdm muirdm commented Jul 24, 2019

Seems to work now, thanks.

@muirdm
Copy link
Contributor Author

@muirdm muirdm commented Aug 13, 2019

I've realized this still doesn't work when you remove directories from the path instead of adding them. For example:

  1. Run (message "dir %s" (read-directory-name "Test: ")) in "foo/bar"
  2. Run ivy-backward-delete-char to remove "bar" from the path.
  3. Run ivy-immediate-done and notice it produces "foo/bar" instead of "foo/".

muirdm added a commit to muirdm/swiper that referenced this issue Aug 13, 2019
When selecting a directory, if you removed elements from the default
directory (e.g. by pressing DEL) and then used ivy-immediate-done, you
were getting back the starting directory instead of the ancestor
directory.

Fixes abo-abo#2165
abo-abo added a commit that referenced this issue Aug 21, 2019
When selecting a directory, if you removed elements from the default
directory (e.g. by pressing DEL) and then used ivy-immediate-done, you
were getting back the starting directory instead of the ancestor
directory.

Fixes #2165
Fixes #2198
astoff added a commit to astoff/swiper that referenced this issue Jan 1, 2021
…name

`read-directory-name' returns "" when the completion function passes
it back the DEF argument. This is a highly questionable behavior that
some old functions depend on.

Looks like it's better to break those old functions, rather than break
the more important functions that have no idea why
`read-directory-name' returns "".

* ivy-test.el (ivy-read-file-name-in-buffer-visiting-file): Now fails.
(ivy-read-directory-name): Add test.

Fixes abo-abo#2165
Fixes abo-abo#2149
Re abo-abo#1170
astoff added a commit to astoff/swiper that referenced this issue Jan 1, 2021
* ivy-test.el (ivy-read-directory-name): Add test.

Fixes abo-abo#2165
astoff added a commit to astoff/swiper that referenced this issue Jan 1, 2021
When selecting a directory, if you removed elements from the default
directory (e.g. by pressing DEL) and then used ivy-immediate-done, you
were getting back the starting directory instead of the ancestor
directory.

Fixes abo-abo#2165
Fixes abo-abo#2198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants