Subject: Re: bug#14829: 24.3; split-window-keep-point breaks shell tab completion

From: Barry Warsaw <[email-masked]>
Date: Fri, 12 Jul 2013 10:18:38 -0400

On Jul 12, 2013, at 12:12 PM, martin rudalics wrote:

> > Maybe it is split, and then deleted, before we have a chance of
> > displaying it?
>
>Maybe it is not split at all for other reasons.  But that decision
>should never be affected by `split-window-keep-point'.  Barry, can you
>check whether and/or why not a window splitting occurs?

With this workaround:

(defadvice completion-at-point (around completion-at-point-around)
  "Point safe completion"
  (let ((split-window-keep-point t))
    ad-do-it))
(ad-activate 'completion-at-point)

and the setup I mentioned earlier (e.g. shell buffer filled with output,
prompt on bottom line of window)...

If you deactivate the advice, what happens when you hit TAB is that you don't
see the split, but you also don't see the completion buffer.  Point just jumps
up to the end-of-line on a line about half-way up the window.

With the advice activated, the window gets split, with the completion buffer
on bottom, and the shell buffer scrolled up so that point remains on the
prompt line which is now approximately in the middle of its buffer (looks to
be a few lines lower, but that's really immaterial).

I notice the exact same behavior in an ERC window, so it's clearly related to
completion-at-point.  Hence the advice in the workaround.