help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scroll buffer so that current line becomes first visible line


From: Xiao-Yong Jin
Subject: Re: scroll buffer so that current line becomes first visible line
Date: Thu, 23 Apr 2009 22:49:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Will Willis <will.willis@gmail.com> writes:

> Hello, Is there a command/key binding to scroll my buffer so that the
> current line (the one with my cursor) becomes the first visible line
> in the window. This is akin to C-l, but instead of centering to the
> point, sticking the current line at the top of the window. I'm _not_
> looking to move the point to the first line (M-0 M-r).
>
> I'm not sure how this would work for shorter files, say only a few
> lines long, would a buffer who's length is shorter than the window
> height be able to scroll?

Yes.  From my emacs version 23.0.92

  C-l runs the command recenter-top-bottom, which is an interactive
  compiled Lisp function in `window.el'.

  It is bound to C-l.

  (recenter-top-bottom &optional arg)

  Move current line to window center, top, and bottom, successively.
  With no prefix argument, the first call redraws the frame and
   centers point vertically within the window.  Successive calls
   scroll the window, placing point on the top, bottom, and middle
   consecutively.  The cycling order is middle -> top -> bottom.

  A prefix argument is handled like `recenter':
   With numeric prefix arg, move current line to window-line arg.
   With plain `C-u', move current line to window center.

  Top and bottom destinations are actually `scroll-margin' lines
   the from true window top and bottom.
--
    c/*    __o/*
    <\     * (__
    */\      <




reply via email to

[Prev in Thread] Current Thread [Next in Thread]