Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I scroll the windows in emacs synchronously?

Tags:

emacs

I mean if I type in c-x 2, then for comparasion I want it to scroll the other window synchronously when I scroll the temporary window.

like image 316
Crazymage Avatar asked Jan 28 '26 14:01

Crazymage


1 Answers

Try Follow Mode:

M-x follow-mode

Follow mode is a minor mode that makes two windows, both showing the same buffer, scroll as a single tall “virtual window”.

Note that follow mode can only synchronize scrolling windows which content a same file. For scrolling windows with diffrent files synchronously, here's an answer for it.

Follow mode can only synchronize scrolling windows which content a same file. Does it possible to scrolling windows with diffrent files synchronously? – 9307420654

There is a minor mode to apply all scrolling commands to all visible windows in the current frame. Check scroll-all-mode for that. Or else, if you want to scroll together only 2 windows and only when you use a specific keystroke, you can do something like a function that scrolls the current window (scroll-up or scroll-down) and then the “other window” (i.e., the next one in the list of windows), with scroll-other-window (with argument '-, i.e., the symbol “minus”, for scrolling down). Then you can assign this to a keystroke, e.g., C-M-up / down.

scroll-all-mode:

Use M-x scroll-all-mode to scroll multiple buffers together.

Very useful for visually comparing two files which are hard to diff because of lots of trivial changes amongst the changes you are looking for.

like image 155
songyuanyao Avatar answered Jan 31 '26 07:01

songyuanyao



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!