Stefan Monnier writes: >> Stefan, a related question: do you think it would be reasonable to split >> completion-table-with-quoting into two functions, separating the >> substitute-in-file-name and comint-quote-filename cases? It seems to me >> that the comint-quote-filename case is way simpler than the >> substitute-in-file-name case, and it would be a lot easier to understand >> if the two cases were done separately, without the abstraction of >> requote and unquote functions. I can do that if that seems reasonable. >> It would make fixing this issue a lot easier. > > It's worth a try. The system we have is the best I could come up with > back then but is hideous, so I'm interested in a simpler solution. OK, here is a rework of just the substitute-in-file-name side. This fixes this bug (by making completion continue to work when point is at /usr/|/), and fixes another FIXME in a test (partial completion now preserves environment variables!). And I don't think it loses anything important, but I may be missing something. (completion--sifn-requote can now be deleted and there are probably other cleanups possible after this patch, but I didn't do them here to keep the patch smaller. Also, rfn-eshadow needs to be updated, but that's just a visual issue.)