Stefan Kangas writes: > Jim Porter writes: > >> On 9/6/2022 6:30 PM, Morgan Smith wrote: >>> I've attached my patch V2. >>> This restores some more of the original logic that I have now realized >>> was indeed necessary. Again, this patch should not actually change >>> anything with respect to program logic, flow, or user experience. In my >>> limited testing, it seems to act just as it did before (but >>> significantly more performant). >> >> Thanks, this does indeed seem a lot faster. I do notice one small change in >> behavior though: after starting Eshell with the em-smart module loaded, run >> "echo hi" and then split the window vertically with 'C-x 2'. Before the patch, >> the window doesn't scroll. After the patch, the window is scrolled so that the >> "echo hi" block is at the top (i.e. the "Welcome to the Emacs shell" banner is >> hidden). >> >> The same sort of thing happens if you run a command with a lot of output first >> and then run "echo hi". Before splitting, the "echo hi" block is at the >> bottom. Without this patch, 'C-x 2' maintains that position (i.e. it scrolls the >> minimum amount of the previous command out of view so that you can see the >> most-recent command). With the patch, 'C-x 2' scrolls *all* of the previous >> command out of view, so the "echo hi" block is at the top. >> >> I think the pre-patch behavior is the most-usable: if you can fit all of the >> last command in the window, it should be at the bottom so that you can see (some >> of) the previous command. >> >> (I also saw some strange issue with resizing the windows via the mouse, but I >> can't reproduce it anymore. If I can figure out how trigger this reliably, I'll >> send an update. Sorry that's not very helpful at present...) > > That was one year ago. > > Morgan, did you get a chance to look into the issues Jim pointed out > above? Thanks for the ping. Reading the documentation for `window-configuration-change-hook' I found out I can run the scroll command only on updated windows. Furthermore, that hook selects the window which is nice. I believe the problems pointed out above stem from using `(point)` to scroll a window that wasn't actually selected. Anyways here is V3