• Stars
    star
    107
  • Rank 323,587 (Top 7 %)
  • Language
    Emacs Lisp
  • Created about 13 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Emacs smooth scrolling package

smooth-scrolling.el

About

This package offers a minor mode which make emacs scroll smoothly. It keeps the point away from the top and bottom of the current buffer's window in order to keep lines of context around the point visible as much as possible, whilst minimising the frequency of sudden scroll jumps which are visually confusing.

This is a nice alternative to all the native scroll-* custom variables, which unfortunately cannot provide this functionality perfectly. For example, when using the built-in variables, clicking with the mouse in the margin will immediately scroll the window to maintain the margin, so the text that you clicked on will no longer be under the mouse. This can be disorienting. In contrast, this mode will not do any scrolling until you actually move up or down a line.

Also, the built-in margin code does not interact well with small windows. If the margin is more than half the window height, you get some weird behavior, because the point is always hitting both the top and bottom margins. This package auto-adjusts the margin in each buffer to never exceed half the window height, so the top and bottom margins never overlap.

See also emacswiki's SmoothScrolling page for more information, although at the time of writing, its content probably did more to confuse than enlighten.

Installation

You have various options, including the following:

Usage

To interactively toggle the mode on / off:

M-x smooth-scrolling-mode

To make the mode permanent, put this in your .emacs:

(require 'smooth-scrolling)
(smooth-scrolling-mode 1)

Difference with smooth-scroll.el

This package should not be confused with the similarly-named smooth-scroll.el, which has similar goals but takes a different approach, requiring navigation keys to be bound to dedicated scroll-{up,down,left,right}-1 functions.

Notes

This only affects the behaviour of the next-line and previous-line functions, usually bound to the cursor keys and C-n/C-p, and repeated isearches (isearch-repeat). Other methods of moving the point will behave as normal according to the standard custom variables.

Prefix arguments to next-line and previous-line are honored. The minimum number of lines are scrolled in order to keep the point outside the margin.

There is one case where moving the point in this fashion may cause a jump: if the point is placed inside one of the margins by another method (e.g. left mouse click, or M-x goto-line) and then moved in the normal way, the advice code will scroll the minimum number of lines in order to keep the point outside the margin. This jump may cause some slight confusion at first, but hopefully it is justified by the benefit of automatically ensuring smooth-scroll-margin lines of context are visible around the point as often as possible.

TODO

  • Maybe add option to avoid scroll jumps when point is within margin.
  • Minimize the number of autoloads in the file. Currently everything is marked as such.

Authors

Originally written by Adam Spiers, it was made into a proper ELPA package by Jeremy Bondeson, and later converted into a minor mode by Ryan C. Thompson.

Thanks also to Mark Hulme-Jones and consolers on #emacs for helping debug issues with line-wrapping in the original implementation.

More Repositories

1

stow

GNU Stow - mirror of savannah git repository occasionally with more bleeding-edge branches
Perl
429
star
2

git-deps

git commit dependency analysis tool
Python
291
star
3

ly2video

generating videos from LilyPond projects
Python
130
star
4

mysqldiff

tool and CPAN suite backend for comparing MySQL database schemas
Perl
125
star
5

shell-env

Adam's shell environment (bash/zsh) including a bunch of handy home-made utilities
Shell
117
star
6

git-config

Adam's git shortcuts and environment. Designed to be stowed to ~ using GNU Stow.
Shell
88
star
7

opensuse-spotify-installer

Automate installation of Spotify on openSUSE
Shell
78
star
8

etrace

Emacs Lisp Latency Tracing for the Chromium Catapult Trace Event Format
Emacs Lisp
71
star
9

git-explode

Explode linear sequence of git commits into topic branches
Python
46
star
10

ansible-viz

Graph relationships between Ansible playbooks / roles / tasks / vars etc. via static analysis
Ruby
40
star
11

book-indices

Indices for music books
24
star
12

mr-config

Adam's mr config
Shell
21
star
13

zkp-eddsa-point-doubler

Zero Knowledge proof for point doubling on baby JubJub elliptic curve, using Zokrates
Shell
12
star
14

orgmode

personal repository for patches to orgmode upstream
Emacs Lisp
11
star
15

lilypond

Friendly fork of GNU Lilypond
C++
11
star
16

emacs

Adam's emacs config
Emacs Lisp
10
star
17

lnav-formats

Extra log file format descriptions for the lnav log file reader
9
star
18

SUSE-dist

SUSE-specific utilities and miscellany
Perl
7
star
19

desktop-config

Set up Adam's Xorg desktop the way he likes it
Shell
7
star
20

mutt

a set of generic configuration files for mutt
Perl
7
star
21

migrationpaths

implementation of VM migration path-finding algorithm
Python
7
star
22

worg

Adam's personal mirror of Worg - user documentation of orgmode for emacs
Emacs Lisp
7
star
23

vc-osc

osc backend for emacs vc mode
Emacs Lisp
6
star
24

ssh-config

Adam's openssh public config and helper scripts
Shell
6
star
25

screenrc

Adam's config for GNU Screen and tmux
Shell
5
star
26

guard-sclang

Guard plugin for automatic testing of SuperCollider code
Ruby
5
star
27

linear-analysis

Analysis of linear.app issues
TypeScript
3
star
28

shell-vars-to-ruby

solution to http://stackoverflow.com/questions/11956850/read-all-shell-variables-in-ruby
Ruby
3
star
29

PDFexploder

Tools for exploding PDFs into fragments based on an index
Ruby
3
star
30

ruby-harmony

Music harmony theory, in Ruby!
Ruby
2
star
31

mutt.pub

Configuration files for mutt specifically written for use by me (Adam), but shared publically for interest.
Shell
2
star
32

list-utils

Utilities relating to mailing lists, NNTP, groups etc.
Python
2
star
33

Finance-Bank-LloydsTSB

CPAN module suite providing a rudimentary interface to the LloydsTSB online banking system at https://online.lloydstsb.co.uk/
Perl
2
star
34

Discord-custom-nicks-userscript

Browser userscript for assigning custom nicknames to users client-side
JavaScript
2
star
35

rpm

tools related to rpm
Shell
1
star
36

rolod0x

TypeScript
1
star
37

cfgctl

Utility for managing config repositories
Perl
1
star
38

zmk-config

1
star
39

github-notifications

Utility for marking github notifications as read via mail clients
Ruby
1
star
40

ET-reporting

Ruby
1
star
41

openstack-day-israel-2017-compute-ha

Presentation on upstream compute HA for OpenStack Day Israel 2017
CSS
1
star
42

mscore-groove

Groove plugin for MuseScore
Jupyter Notebook
1
star
43

ANTIFOLD

ugly hack to prevent GNU Stow from folding certain directories under $HOME
Shell
1
star
44

compute-ha-presentation

Presentation on compute HA for OpenStack
CSS
1
star
45

obs-service-tar_scm.historic

Python
1
star
46

etheriopia

Browser userscript to fix two bugs with Twitter
JavaScript
1
star