CeleritasCelery / emacs-native-shell-complete

Completion in shell buffers using native mechanisms
GNU Lesser General Public License v3.0
98 stars 9 forks source link

Multi-line prompt is considered as a candidate #5

Closed cpitclaudel closed 2 years ago

cpitclaudel commented 4 years ago

My prompt is on two lines; it looks like this:

<date> <pwd>
$ 

As a result, the current working directory always and up as part of my completion list. I used this:

(setq-default native-complete-style-regex-alist '(("^.*\n\\$ " . bash)))

And the regexp does seem to work fine (if I change bash to foo and call (native-complete-get-completion-style) I get foo), but I still get my current working directory included in completions.

Maybe there's a way to print a special delimiter at the end of the completion list to solve this problem?

Thanks again for your work on this. I'm excited to finally have decent completion in my emacs shell.

CeleritasCelery commented 4 years ago

You can add a function to comint-redirect-filter-functions to remove your second prompt line. native-complete-style-regex-alist is only used for determining the completion style and regex doesn't have any effect beyond that.

Maybe there's a way to print a special delimiter at the end of the completion list to solve this problem?

That's an interesting idea. I will have to look into that more. Though that would only work for bash style completion.