[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

47. Scrolling In Place

This library provides improved vertical scrolling commands for GNU Emacs.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

47.1 Features

The new vertical scrolling commands offer the following features:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

47.2 Command and Functions

This library provides the following "in place" versions of GNU Emacs’ standard vertical scrolling commands:

The variable scroll-in-place, which is true by default, determines whether or not the new versions of the standard GNU Emacs scrolling commands (scroll-down, scroll-up, scroll-other-window-down, and scroll-other-window) use the "in place" features listed above. When scroll-in-place is nil the standard GNU Emacs scrolling commands essentially just call the original versions of themselves. (Note that even when scroll-in-place is nil the new versions of scroll-down and scroll-up have slightly different behavior when a minibuffer window is the selected window. See the feature list above.)

NOTE that this package redefines the standard GNU Emacs commands scroll-down, scroll-up, scroll-other-window-down, and scroll-other-window (in order to check the variable scroll-in-place, as described above). The command scroll-other-window-down first appeared as a standard command in the FSF’s GNU Emacs 19.26.

This package also provides the following functions and variables which are of use to programmers:

The scroll-window-in-place function is the heart of the "in place" scrolling commands. scroll-window is a function that checks the variable scroll-in-place and calls the appropriate scrolling function (either scroll-window-in-place or one of the original versions of scroll-down and scroll-up). The function scroll-window-in-place-continue-sequence is provided in order to preserve running "chains" of scrolling commands as described above.

The variable scroll-default-lines determines the default scrolling distance when a new chain of "in place" scrolling commands begins. If this variable is not a number, then the default distance is the height of the window to be scrolled minus next-screen-context-lines. The variable scroll-command-groups contains the explicit groups of "in place" scrolling commands; for more information read the variable documentation.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

47.3 Installation

To use this package, you simply need to load it from within your initialization file:

 
  (require 'scroll-in-place)

By default, this package provides for the standard GNU Emacs vertical scrolling commands (scroll-down, scroll-up, scroll-other-window-down, and scroll-other-window) to use the "in place" features. If you would rather not have this, set the variable (setq scroll-in-place nil).

When scroll-in-place is nil you will have to bind keys in order to call the "in place" scrolling commands. For example, you might want to do the following:

 
  (global-set-key "\M-v" 'scroll-down-in-place)
  (global-set-key "\C-v" 'scroll-up-in-place)

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

47.4 Advanced Customization

If you want to partition certain "in place" scrolling commands into separate groups, you should do something like the following:

 
  ;; Make one group containing the commands `scroll-down-one-line' and
  ;; `scroll-up-one-line'.  (These are not standard GNU Emacs commands.)
  (setq scroll-command-groups
        (list '(scroll-down-one-line scroll-up-one-line)))

You could write the ‘scroll-down-one-line’ command like this:

 
  (defun scroll-down-one-line (arg)
    "Scroll down one line, or number of lines specified by prefix arg."
    (interactive "P")
    (let ((scroll-default-lines 1))
      (scroll-down-in-place arg)))

If you want to disable "in place" scrolling for windows that display a particular buffer (while leaving it available in other windows), you can make scroll-in-place a buffer-local variable for that buffer and then bind that local copy of scroll-in-place to nil. This is the kind of thing that one generally does in a major mode hook. For example, you can disable "in place" scrolling of GNUS article windows with the following code:

 
  (setq gnus-article-mode-hook
        (function (lambda ()
                    (make-local-variable 'scroll-in-place)
                    (setq scroll-in-place nil))))
  ;; Set the variable `gnus-Article-mode-hook' instead if you are using
  ;; an old version of GNUS, say version 3.13 or 3.14.

The variable scroll-allow-blank-lines-past-eob can also be made local to particular buffers, if you desire. (But why would you want to do that?)


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Aidan Kehoe on December 27, 2016 using texi2html 1.82.