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

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

Re: How do you scroll the screen without moving the cursor ? (theC-E and


From: Chris McMahan
Subject: Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
Date: Fri, 03 Oct 2008 16:07:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (windows-nt)

Paul R <paul.r.ml@gmail.com> writes:

> Chris> If that's not what you have in mind, I've been using these for
> Chris> some time. They keep the cursor in place and move the text
> Chris> underneath it.
>
> Chris> (defun scroll-down-in-place (n) (interactive "p")
> Chris> (previous-line n) (scroll-down n))
>
> Chris> (defun scroll-up-in-place (n) (interactive "p") (next-line n)
> Chris> (scroll-up n))
>
> To avoid weird behaviour when seeing ends of your buffer, use the code
> below.
>
> (global-set-key [down] (lambda ()
>                        (interactive)
>                        (next-line 1)
>                        (unless (eq (window-end) (point-max))
>                          (scroll-up 1))))
> (global-set-key [up] (lambda ()
>                      (interactive)
>                      (previous-line 1)
>                      (unless (eq (window-start) (point-min))
>                        (scroll-down 1))))

Excellent! Thank you!

BTW, where can I get info on the key syntax you're using? [down] and
[up]...

- Chris

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================


reply via email to

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