On 2/5/2023 7:33 AM, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > BTW, a low-tech way to get similar results is to change your completion > table. Instead of having entries like > > user-login-name > > make it contains entries like: > > user-login-name" ... I'd thought about this, but it gets a little uglier for more-complex cases like bug#53371, which wants to complete things like the "foo" in "#". > Regarding `pcomplete-exit-function`: > - It's ugly and I don't like it, but given the general design of the > current Pcomplete API, I think it's OK. Yeah, I'd rather do it by returning some structured object, but that would probably require some significant incompatible changes to pcomplete... > - Please add a good docstring to that variable (the fact that the other > vars nearby don't have any is no excuse, instead it's a(nother) > problem that should be fixed). Done. > - Maybe `pcomplete-exit-function` should override the default exit > function (i.e. the handing of `pcomplete-termination-string`) rather > than being added to it? > E.g. we could start with `pcomplete-exit-function` bound to the > default (the one that handles `pcomplete-termination-string`) and let > the rest of the code modify it either with `setq` (to completely > override) or `add-function`. I like this a lot better than my previous solution. Done. I also changed the last patch to return a programmed completion function that mimics "~user" completion in 'completion-file-name-table'. That seems like a more-consistent way to handle that case, since now Eshell "~user" completion works the same as completing any file name.