32
votes
Accepted
Synchronized scrolling in two windows
M-x scroll-all-mode does exactly that.
You can also refer to the emacs wiki on scroll-all-mode and how to make synchronized scrolling work with mouse scrolling.
13
votes
Why doesn't M-v following C-v move cursor back to the original position?
You can try setting scroll-preserve-screen-position to always:
(setq scroll-preserve-screen-position 'always)
From the documentation (C-h v scroll-preserve-screen-position):
Controls if scroll ...
11
votes
Let Emacs move the cursor off-screen
There is a new package available on GNU ELPA called scroll-restore that attempts to remedy this problem. There are a handful of different behaviors to choose from, but the way I have configured it for ...
10
votes
Smooth (mouse) scroll for inline images?
Since Emacs 26.1, the buffer can be scrolled by individual pixels instead of just lines which can be used to smoothly scroll over images using the mouse wheel. To achieve this I have used the ...
9
votes
Accepted
How can I scroll a half page on C-v and M-v?
I actually managed to find the equivalent functions. They are
View-scroll-half-page-forward
View-scroll-half-page-backward
So, I've updated my dotfile's user-config section to contain
(global-set-...
8
votes
Scrolling during isearch stops searching, losing matches
@legosia's answer is the usual one, and probably what you want. But be aware that there is an alternative Isearch behavior that lets you scroll the buffer being searched without exiting Isearch.
If ...
8
votes
Accepted
Smooth scrolling by pixel-lines
M-x pixel-scroll-mode, available since Emacs 26, is all that's needed to have pixel scrolling. Credit to @db48x
8
votes
Automatically scroll *compilation* window, beside source-buffer window
This behaviour can be controlled by compilation-scroll-output.
compilation-scroll-output is a variable defined in `compile.el'.
Its value is `first-error'
Original value was nil
Documentation:
Non-...
7
votes
Accepted
How to center the current line vertically during Isearch
For Isearch, you can set option isearch-allow-scroll to non-nil. That lets you scroll the buffer you are searching, without exiting Isearch.
And note that "scrolling" here includes C-l, which ...
7
votes
Accepted
Emacs sometimes starts automatically recentering cursor position
The answer is here. You probably have a buffer-list open somewhere, and version 24.3 has a bug in tabulated-list-mode which causes the periodic recentering. If you close that buffer-list, behaviour ...
7
votes
Accepted
emulation of scroll-off?
The variable scroll-margin controls this behaviour:
Number of lines of margin at the top and bottom of a window.
Recenter the window whenever point gets within this many lines
of the top or ...
6
votes
How to center the current line vertically during Isearch
The simplest way to do this is:
(defadvice isearch-update (before my-isearch-reposite activate)
(sit-for 0)
(recenter 1))
A better but more complicated:
(defadvice isearch-update (before my-...
5
votes
Accepted
How to preserve the visual height of the cursor after an operation?
You can use (count-screen-lines &optional beg end count-final-newline window) (manual page) to find the number of lines shown between two points.
You can do the following to re-create the point's ...
5
votes
Accepted
Hook that indicates when the cursor has been moved by scrolling
Yes.
The functions in window-scroll-functions are called just before a redisplay that would cause scrolling. Each function returns two arguments, the window window and the new window start position ...
5
votes
Accepted
How to scroll to the beginning of the line in Emacs
The window has been scrolled left (scroll-left) for some reason.
C-x < or C-<next> can get you into this state.
C-x > or C-<prior> can get you out of this state.
Note those commands ...
4
votes
Let Emacs move the cursor off-screen
The method that I always use is to set the mark where I want to jump back to, and then when I am done perusing the buffer, I pop the mark using C-u C-SPC. Even when I forget to set the mark before ...
4
votes
Accepted
How to ensure lines are always displayed in groups of 3?
Here is an alternative function that respects the major mode and works with window-size-change-functions:
(defun reposition-buffer (frame)
(when (eq major-mode 'fundamental-mode) ; Substitute name ...
4
votes
Scroll vertically while keeping horizontal position
I believe you're looking for something like:
(setq scroll-preserve-screen-position 'always)
3
votes
How to get `window-end` when the window scrolls?
The best a user can achieve -- without forcing a redisplay or without modifying the C-source code -- is use the window-end function with the optional second argument set to t in conjunction with the ...
3
votes
Accepted
How to recreate iA Writer-style typewriter scrolling in Emacs?
centered-cursor-mode Makes the cursor stay vertically in a defined position (usually centered). The vertical position can be altered, see key definition below. http://melpa.org/#/centered-cursor-mode
...
3
votes
Smooth (mouse) scroll for inline images?
How about this:
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't ...
3
votes
Accepted
Scrolling during isearch stops searching, losing matches
After scrolling down, hit C-s twice. That will restart the search, using the search string from the previous time you used C-s.
3
votes
Accepted
zs and ze from Vim?
It's easy enough to set the horizontal position of the current window.
(defun hscroll-cursor-left ()
"Scroll horizontally to bring the cursor to the leftmost visible column.
Similar to Vim's `zs'."
...
3
votes
How disable "unexpected" scrolling behavior in small frames
Adjust option scroll-margin to your liking. (You might also want to look at option scroll-step.)
Number of lines of margin at the top and bottom of a window.
Recenter the window whenever point ...
3
votes
How to ensure lines are always displayed in groups of 3?
The following function checks a window to see if it's top line is a multiple of three, and scrolls if needed to make it so:
(defun first-window-line-in-threes (&optional window)
"Make sure that ...

Dan♦
- 31.2k
3
votes
How can I scroll a half page on C-v and M-v?
I personally recommend you to use a package named golden-ratio-scroll-screen.
You can add melpa to your package-list if you have not.
(add-to-list 'package-archives '("melpa" .
"https://melpa.org/...
3
votes
ansi-term scroll problem on fast output
Solved it by myself. Just needed to add the following lines to ~/.emacs.d/init.el:
(eval-after-load "term"
'(progn
;; ensure that scrolling doesn't break on output
(setq term-scroll-to-...
3
votes
Accepted
How to prevent org-mode from repositioning text in the window when cycling visibility?
The TAB key runs the command org-cycle, which does a
whole bunch of stuff under the hood. In the context you're
talking about, org-cycle cycles through the visibility of the
buffer, hiding and ...

Dan♦
- 31.2k
3
votes
Accepted
How to vertically center when opening a file:line from emacsclient?
You can always choose the --eval option of emacsclient to perform more complicated tasks:
emacsclient --eval "(progn (find-file \"$FILE\") (goto-line $NUM) (forward-char $COL) (recenter))"
3
votes
How to scroll while using multiple cursor?
In Emacs, the points (cursor) is always on the visible portion of the file you are visiting. This coded deep down in the guts of the program, so you won't be able to change this without a great deal ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scrolling × 107window × 12
mouse × 10
cursor × 8
key-bindings × 6
evil × 6
hooks × 5
motion × 5
buffers × 4
point × 4
org-mode × 3
minor-mode × 3
images × 3
isearch × 3
spacemacs × 2
init-file × 2
elisp × 2
debugging × 2
microsoft-windows × 2
frames × 2
fonts × 2
emacsclient × 2
search × 2
terminal-emacs × 2
text-editing × 2