-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
In eshell's completion-at-point, consult-completion-in-region places the minibuffer point in the middle of the completion string #48
Comments
Workaround: Remove this clause: Lines 627 to 632 in b5cbc61
More practical workaround:
|
@oantolin ideas? |
Huh. Like @tomfitzhenry pointed out, it's read-file-name that's doing that! I don't know why, but it chooses to put point before the argument How about just forcing the move to the end of line? We can wrap the call to |
@tomfitzhenry are you using selectrum or icomplete btw? |
I can reproduce this issue with |
It's definitely something that |
I'll try to reproduce this using just |
If it is not our bug, I would not fix it here. As long as we are sure we did everything alright. |
The steps to reproduce are simple. I'll raise this upstream.
|
Regarding the initial value - this has been deprecated for the completing-read API, but for the read-file-name API it is fine? The docs only say "Please note: we recommend using default rather than initial in most cases". See https://www.gnu.org/software/emacs/manual/html_node/elisp/Reading-File-Names.html. |
Further, that page says "If you specify initial, that is an initial file name to insert in the buffer (after directory, if that is inserted). In this case, point goes at the beginning of initial." That is, the behaviour we observe is the expected behaviour. I can't tell why that is desirable behaviour (even given the described example of find-alternate-file). I won't raise this upstream: it's working as intended. Our options: |
I lean towards (i) since:
How important is this usecase? Are there file-specific bindings that people would want during a completion-at-point? |
Why not raise it upstream, if you think it is bad behavior? Option (i) would revert the special behavior for files, which has been done for consistency with how selectrum. It and it also makes sense to use read-file for the file category, I think. But I was not really involved the design of this function, @oantolin made it and we got some feedback by @clemera. |
I think I've found a way to avoid using Update: This works, but prompts with a relative path (and so doesn't look like a prompt for a filename). Try to make that an absolute prompt, and then results are absolute. Fixing that partly amounts to reimplementing read-file-name! |
@tomfitzhenry Since this already has issues and it won't work nicely with recursive minibuffer I think it would be better to keep using read-file-name or not use it at all. But this has to be discussed. See #31 for the original discussion. |
Personally, I'd go with @tomfitzhenry's option (iii), use the directory argument: even if this behavior is not documented it seems unlikely to change. |
Haha, the undefined behavior. I am fine with it as long as it works. If at some point it stops working we can file a bugreport to upstream 🙈 |
Exploiting the undefined behavior seems to work just fine, and it really isn't likely to change any time soon. I'll make a pull request. |
Closed by #63 |
Steps to reproduce
GNU Emacs 27.1
consult: b5cbc61
In eshell, run:
Expected
I'm prompted "Completion: foo|" where
|
indicates where I expect point to be.Actual
I'm prompted "Completion: |foo".
This is a problem because I then type "b" (to try to complete "foob" to "foobar"), the minibuffer actually shows "bfoo" which fails to complete.
The text was updated successfully, but these errors were encountered: