Subject: bug#36733: 27.0.50; Eshell taking long time to enter directory after TAB completion

From: Ivan Kozlov <[email-masked]>
Date: Sat, 29 Feb 2020 09:40:24 +0300

I have identified the problem. completion-in-region uses markers to identify the beginning and the end of the region where the completion is active. The markers are saved into the list completion-in-region--data.

completion-in-region--post checks if the point has left the buffer, in which case it quits the completion mode (as I have already noted):

                (>= (point) (nth 0 completion-in-region--data))
                (<= (point)
                    (save-excursion
                      (goto-char (nth 1 completion-in-region--data))
                      (line-end-position)))

Erasing text or entering line feed moves markers, it appears to be their whole purpose. Here is the problem. The markers move and the conditions above give true, so 1) completion-in-mode--predicate is called 2) completion-in-region mode remains active, both of which are wrong.

My investigation must end here. I don’t know why completion-in-region-mode is using markers (to enter text outside the region you probably need to move the point out of it, which exits the mode), and I don’t know if it is possible to avoid this situation when using them. All I know is that the current behavior is wrong and doesn’t make any sense. I do hope somebody chimes in who has any ideas.