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 cause read-file-name bug #514

Closed
zilongshanren opened this issue May 20, 2016 · 10 comments
Closed

ivy cause read-file-name bug #514

zilongshanren opened this issue May 20, 2016 · 10 comments

Comments

@zilongshanren
Copy link

when call read-file-name without a chosen parameter, ivy still use default-directory as the input which is weird

@abo-abo
Copy link
Owner

abo-abo commented May 20, 2016

A minimal example, please.

@zilongshanren
Copy link
Author

zilongshanren commented May 20, 2016

At first, turn ivy-mode on, open any file and press M-S-: to execute the sexp (read-file-name "test:" ~/.emacs.d"),

it will list the current file's directory rather than the files in "~/.emacs.d" directory.

@zilongshanren
Copy link
Author

zilongshanren commented May 20, 2016

@abo-abo
If I give a extra 3nd parameter to the read-file-name function, it will give me the correct file lists.

@abo-abo
Copy link
Owner

abo-abo commented May 20, 2016

That's because the first arg is prompt and the second is dir.
This works:

(read-file-name "test: " "~/.emacs.d")

@zilongshanren
Copy link
Author

@abo-abo
sorry, my mistake, (read-file-name "test: " "~/.emacs.d") is still not working...

@zilongshanren
Copy link
Author

@abo-abo if I call (read-file-name "test: " "~/.emacs.d") in scratch buffer , then the result is correct, but it's not working when I open any files in my disk...

@abo-abo
Copy link
Owner

abo-abo commented May 20, 2016

Read the doc of read-file-name:

DIR is the directory to use for completing relative file names.
It should be an absolute directory name, or nil (which means the
current buffer's value of `default-directory').

You must use an absolute path.

@zilongshanren
Copy link
Author

zilongshanren commented May 20, 2016

@abo-abo

it's still not working... when I disable the ivy-mode, problem solves...

(read-file-name "Load perspectives from a file: "
                                       "/Users/guanghui/.emacs.d/")

/Users/guanghui is my HOME directory, am I wrong here?

Thanks.

abo-abo added a commit that referenced this issue May 20, 2016
* ivy.el (ivy--reset-state): Prefer the directory of `initial-input',
  rather than the directory of `preselect'.

Re #514
@abo-abo
Copy link
Owner

abo-abo commented May 20, 2016

Please check.

@zilongshanren
Copy link
Author

@abo-abo 👍 thanks, problem solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants