Subject: Re: bug#11697: 24.1.50; ERC scroll-to-bottom functionality 'broken' in emacs 24.1.x

From: Antoine Levitt <[email-masked]>
Date: Thu, 14 Jun 2012 23:03:46 +0200

14/06/12 22:51, Deniz Dogan
>>> Firstly, I agree with you completely that scrolltobottom needs
>>> improvements.  I can't be sure why they changed the behavior, since
>>> the new method is clearly inferior, but I believe it's because
>>> window-scroll-functions is never meant to change "the way the window
>>> is scrolled".
>>
>> Hi,
>>
>> I'm responsible for the mess. Sorry, I don't customize
>> erc-input-line-position, and it didn't occur to me that it might mess
>> things up. I tried to think of something better for erc-scrolltobottom,
>> but I'm not familiar with erc internals and that was the best I could
>> do. The reason for the change was that as you said,
>> window-scroll-functions is not intended to be used like that, and it
>> caused weird bugs.
>>
>>> I've monkey-patched ERC myself to handle the whole thing better.  I've
>>> attached the Lisp.  Just evaluate all the code and you'll be all
>>> set. (I know it's not production-quality code, but it does the job and
>>> relieves you from ever thinking about it again.)
>>
>> Great! Could you submit a proper patch, so that Someone (tm; there seems
>> to be a lack of maintainers for ERC) can review it and merge it into
>> trunk? erc-scrolltobottom has been broken for years, with weird bugs and
>> excessive CPU consumption, and it's high time it changed.
>>
>
> The excessive CPU consumption comes from the fact that it nowadays
> uses post-command-hook, which is executed just about all the time.  :)

I don't think so, I had excessive CPU consumption before the code used
post-command-hook (main way to trigger is to hold a random key down
while watching the result of top. It's already appalling in ERC without
erc-scrolltobottom, but it's even worth with it).

The way I see it, this scrolltobottom thing is a problem that is global
to emacs and has nothing to do with ERC in particular. For instance, I
also want my shell buffers not to scroll past the end of
buffers. Actually I think (but am not sure ; it would require testing)
I'd want all buffers to behave that way, and never, ever display
anything past the end of the buffer. An ideal solution would be a local
variable, that'd inhibit "bad" recentering (and therefore would not
incur any performance loss, as I believe the main loss is when a hook
recenters after it has already been recentered). But that's more
ambitious.