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

Comments

Projects
None yet
2 participants
@zilongshanren

zilongshanren commented May 20, 2016

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

@abo-abo

This comment has been minimized.

Owner

abo-abo commented May 20, 2016

A minimal example, please.

@zilongshanren

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

zilongshanren commented May 20, 2016

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

@zilongshanren

This comment has been minimized.

zilongshanren commented May 20, 2016

@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

This comment has been minimized.

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

This comment has been minimized.

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

When reading file names, check preselect and initial-input compat
* ivy.el (ivy--reset-state): Prefer the directory of `initial-input',
  rather than the directory of `preselect'.

Re #514
@abo-abo

This comment has been minimized.

Owner

abo-abo commented May 20, 2016

Please check.

@zilongshanren

This comment has been minimized.

zilongshanren commented May 20, 2016

@abo-abo 👍 thanks, problem solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment