unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* scroll buffer so that current line becomes first visible line
@ 2009-04-24  2:18 Will Willis
  2009-04-24  2:49 ` Xiao-Yong Jin
  0 siblings, 1 reply; 7+ messages in thread
From: Will Willis @ 2009-04-24  2:18 UTC (permalink / raw)
  To: help-gnu-emacs

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?

Thanks,
Will




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scroll buffer so that current line becomes first visible line
  2009-04-24  2:18 Will Willis
@ 2009-04-24  2:49 ` Xiao-Yong Jin
  2009-04-24  8:38   ` Nikolaj Schumacher
  0 siblings, 1 reply; 7+ messages in thread
From: Xiao-Yong Jin @ 2009-04-24  2:49 UTC (permalink / raw)
  To: help-gnu-emacs

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/*
    <\     * (__
    */\      <




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scroll buffer so that current line becomes first visible line
       [not found] <mailman.5917.1240539505.31690.help-gnu-emacs@gnu.org>
@ 2009-04-24  8:35 ` Tim X
  2009-04-24 11:17   ` Will Willis
  2009-04-24 14:01   ` Drew Adams
  2009-04-24 15:28 ` Giorgos Keramidas
  1 sibling, 2 replies; 7+ messages in thread
From: Tim X @ 2009-04-24  8:35 UTC (permalink / raw)
  To: help-gnu-emacs

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?
>
maybe of no real help, but....

Emacs 23 (CVS emacs) has re-worked C-l. When you press it the first
time, it centers (old behavior). Press it again and the line is put  at
the top of the buffer, hit it a third time and it goes to the
bottom. I've found it really useful. 

It may be possible to retro-fit it to emacs 22?

Tim


-- 
tcross (at) rapttech dot com dot au


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scroll buffer so that current line becomes first visible line
  2009-04-24  2:49 ` Xiao-Yong Jin
@ 2009-04-24  8:38   ` Nikolaj Schumacher
  0 siblings, 0 replies; 7+ messages in thread
From: Nikolaj Schumacher @ 2009-04-24  8:38 UTC (permalink / raw)
  To: help-gnu-emacs

Xiao-Yong Jin <xj2106@columbia.edu> wrote:

>> 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.
>
> Yes.  From my emacs version 23.0.92

In Emacs 22 you can do C-u 0 C-l

regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scroll buffer so that current line becomes first visible line
  2009-04-24  8:35 ` scroll buffer so that current line becomes first visible line Tim X
@ 2009-04-24 11:17   ` Will Willis
  2009-04-24 14:01   ` Drew Adams
  1 sibling, 0 replies; 7+ messages in thread
From: Will Willis @ 2009-04-24 11:17 UTC (permalink / raw)
  To: help-gnu-emacs

Thank you all for the help!!

-Will

On Fri, Apr 24, 2009 at 3:35 AM, Tim X <timx@nospam.dev.null> wrote:
> 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?
>>
> maybe of no real help, but....
>
> Emacs 23 (CVS emacs) has re-worked C-l. When you press it the first
> time, it centers (old behavior). Press it again and the line is put  at
> the top of the buffer, hit it a third time and it goes to the
> bottom. I've found it really useful.
>
> It may be possible to retro-fit it to emacs 22?
>
> Tim
>
>
> --
> tcross (at) rapttech dot com dot au
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: scroll buffer so that current line becomes first visible line
  2009-04-24  8:35 ` scroll buffer so that current line becomes first visible line Tim X
  2009-04-24 11:17   ` Will Willis
@ 2009-04-24 14:01   ` Drew Adams
  1 sibling, 0 replies; 7+ messages in thread
From: Drew Adams @ 2009-04-24 14:01 UTC (permalink / raw)
  To: 'Tim X', help-gnu-emacs

> maybe of no real help, but....
> Emacs 23 (CVS emacs) has re-worked C-l. When you press it the first
> time, it centers (old behavior). Press it again and the line 
> is put  at the top of the buffer, hit it a third time and it goes
> to the bottom. I've found it really useful. 
> 
> It may be possible to retro-fit it to emacs 22?

Yes, this is originally from my code, and it is available for Emacs 22,21, 20
here: http://www.emacswiki.org/emacs/misc-cmds.el.

So, to move the current line to the top, use C-l C-l.
To move it to the bottom, use C-l C-l C-l.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scroll buffer so that current line becomes first visible line
       [not found] <mailman.5917.1240539505.31690.help-gnu-emacs@gnu.org>
  2009-04-24  8:35 ` scroll buffer so that current line becomes first visible line Tim X
@ 2009-04-24 15:28 ` Giorgos Keramidas
  1 sibling, 0 replies; 7+ messages in thread
From: Giorgos Keramidas @ 2009-04-24 15:28 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 23 Apr 2009 21:18:20 -0500, Will Willis <will.willis@gmail.com> wrote:
> 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?

`C-l' works with a prefix too, so you can type `C-u 0 C-l' to redisplay
the buffer with the current line on top, or `C-u 30 C-l' to redisplay
everything and move the current line at line 30.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-24 15:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.5917.1240539505.31690.help-gnu-emacs@gnu.org>
2009-04-24  8:35 ` scroll buffer so that current line becomes first visible line Tim X
2009-04-24 11:17   ` Will Willis
2009-04-24 14:01   ` Drew Adams
2009-04-24 15:28 ` Giorgos Keramidas
2009-04-24  2:18 Will Willis
2009-04-24  2:49 ` Xiao-Yong Jin
2009-04-24  8:38   ` Nikolaj Schumacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).