Subject: Re: bug#57367: [PATCH] Speed up em-smart

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 06 Sep 2022 12:00:26 +0200

(Please keep the debbugs address in the CCs -- otherwise it won't reach
the bug tracker.)

Morgan Smith <[email-masked]> writes:

> So the hook is local to the buffer but it runs this bit of code:
>
> (set-window-start (selected-window) (line-beginning-position) t)
>
> So I want to set all windows that refer to the hook buffer to start at a
> certain location.  Ideally I want to do this even if the window doesn't
> currently exist as I want it to be properly scrolled when I get back to
> it.

Hm, right.

> I guess that explains why the original author simply walked through
> all windows and also attached the hook to
> `window-configuration-change-hook'.  I guess I could restore the
> original solution but it doesn't seem particularly elegant.
>
> Let me know if you have a better idea, otherwise I'll simply send
> another patch that puts some of the old stuff back in.

I think you probably have to wait until the window actually exists to
effect scrolling in it (you may have the same buffer in several windows,
or in none), really, so I think walking the windows is the only
practical solution here.

But there may be other tricks here -- perhaps somebody else has some
ideas.