Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
46f2aa14
Commit
46f2aa14
authored
Aug 18, 2008
by
Chong Yidong
Browse files
(recenter-top-bottom): Determine top and bottom positions using
scroll-margin instead of scroll-conservatively.
parent
0444738f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
lisp/window.el
lisp/window.el
+14
-15
No files found.
lisp/window.el
View file @
46f2aa14
...
...
@@ -1436,26 +1436,25 @@ top, middle, or bottom on successive calls.
The
cycling
order
is:
middle
->
top
->
bottom.
Top
and
bottom
destinations
are
actually
`
scroll-
conservatively
'
lines
from
true
window
top
and
bottom.
"
Top
and
bottom
destinations
are
actually
`
scroll-
margin
'
lines
the
from
true
window
top
and
bottom.
"
(interactive "
P
")
(cond
(arg (recenter arg)) ; Always respect ARG.
((not (eq this-command last-command))
;; First time - save mode and recenter.
(
(or
(not (eq this-command last-command))
(eq recenter-last-op 'bottom))
(setq recenter-last-op 'middle)
(recenter))
(t ;; repeat: loop through various options.
(setq recenter-last-op
(cond ((eq recenter-last-op 'middle)
(recenter scroll-conservatively)
'top)
((eq recenter-last-op 'top)
(recenter (1- (- scroll-conservatively)))
'bottom)
((eq recenter-last-op 'bottom)
(recenter)
'middle))))))
(t
(let ((this-scroll-margin
(min (max 0 scroll-margin)
(truncate (/ (window-body-height) 4.0)))))
(cond ((eq recenter-last-op 'middle)
(setq recenter-last-op 'top)
(recenter this-scroll-margin))
((eq recenter-last-op 'top)
(setq recenter-last-op 'bottom)
(recenter (- -1 this-scroll-margin))))))))
(define-key global-map [?\C-l] 'recenter-top-bottom)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment