If I create a new buffer (C-x b) named "test-4" (for example) and then click C-x w to save, I am prompted by selectrum to write the file. It also correctly suggests test-4 as a filename. However, if I then navigate to another directory to save the file, the suggested file name is lost.
Thanks, I understand it would be convenient to have it persists in this case but if you try with emacs -Q it also behaves like that. You can submit the default by accepting the prompt with RET but this only works at the initial prompt. The default value is the full path to the initial prompt not a relative name.
Although the name of the buffer is not visible it is preserved in both icomplete and the default Emacs minibuffer and is correctly inserted with tab as the filename, despite a change of directory. If memory serves me well (I may be wrong) ivy displays the name and preserves it.
Sorry I can't reproduce that, I just tried again and I don't see the name suggested with icomplete and also can't insert it with TAB in default completion. I also tried ivy and it doesn't seem to suggest it at all (even at the initial prompt). I tested with Emacs 27.1 and no additional configuration loaded.
If you want to share media files please add them via github comment.
Note that the file isn't playable. Can you provide a recipe to get what you describe using emacs -Q?
If I start Emacs using emacs -Q I can create a new buffer of filename "test-123" and save it as a file to any directory of my choosing using C-x w + <RET>. I am using Emacs 28.0.50
I see, you mean that you can submit the prompt directory and it will save as the /prompt/dir/buffer-name. You can still do that with Selectrum by selecting the prompt (using C-p RET) or submit it immediately via C-j. I agree that this isn't as discoverable as suggesting the name all the time but showing it all the time could have unwanted side effects in other cases, I have to think about how the discoverability could be improved in this case or if I can think of another general approach.
Note that you can also select a dir immediately when it is part of the candidate list with RET before moving into it via TAB
Looking back into this, the problem is that the command write-file is special: If your buffer isn't associated with a file it will construct the file name out of the selected directory and the buffer name. The default file name is still only valid on the initial prompt and that is the case where it is shown with Selectrum. We would have to introduce a special case for write-file but given that this also isn't indicated with the default UI I don't think that is necessary. I also tested with ivy and it doesn't even suggest the default file name on the initial prompt so we seem to already do a better job with that. With the above reasons I don't think there is anything to act on, what do you think?
Yes, I agree.