szermatt / emacs-bash-completion

Add programmable bash completion to Emacs shell-mode
GNU General Public License v2.0
281 stars 33 forks source link

Add a new option to disable the use of separate processes to perform completion #34

Closed montag451 closed 4 years ago

montag451 commented 5 years ago

The drawback of using separate processes to do the completion is that the completion process is not aware of any changes made to bash in the current buffer. Setting the new option `bash-completion-use-separate-processes' to nil, remove this limitation by using the bash associated with the current buffer to perform the completion.

montag451 commented 5 years ago

Not ready for merge. I have to find a way to handle continuation line and to prevent completion when the point is not on a line where trying completion make sense.

szermatt commented 5 years ago

Nice, thank you! I'll have a good look at it and try it out this week-end.

I'd be quite interested in bash completion running in the same process, if we can make it run nicely. This would be especially useful for remote shells. It could potentially fully replace the multi-process solution; this would be a nice simplification.

When I initially developed it, I didn't manage to make it work properly. I had troubles with:

This is all fixable with enough efforts.

montag451 commented 5 years ago

I'll have a good look at it and try it out this week-end.

Great, thank you!

It could potentially fully replace the multi-process solution; this would be a nice simplification.

You will need to keep separate processes when the current buffer is not associated with a process (for example when shell-command is run interactively, the completion is attempted in the minibuffer)

When I initially developed it, I didn't manage to make it work properly. I had troubles with:

  • messages from bash, such as mail checks background jobs ending up as completions
  • artifacts from bash communications ending up in the normal shell
  • prompts interfering with the bash communication (my PS1 is quite complex)

Unfortunately I don't think that my implementation will solve these issues. But even if these problems can't be solved I think it would be nice to let the user choose if he wants the completion to be done in separate processes or in the same process (this is the case in my implementation).

montag451 commented 5 years ago

Hi @szermatt,

Thank you for your feedback, I will try to work on the package this week-end and to answer all your remarks