From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris McMahan Newsgroups: gmane.emacs.help 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 Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <7sk5cph283.fsf@one.dot.net> References: <7sod21hf0r.fsf@one.dot.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1223066445 6203 80.91.229.12 (3 Oct 2008 20:40:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Oct 2008 20:40:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 03 22:41:42 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KlrT3-0007mZ-Ar for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Oct 2008 22:41:41 +0200 Original-Received: from localhost ([127.0.0.1]:50324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlrRz-0005Wr-Pk for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Oct 2008 16:40:35 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news-out.readnews.com!transit3.readnews.com!panix!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: panix5.panix.com Original-X-Trace: reader1.panix.com 1223064425 20576 166.84.1.5 (3 Oct 2008 20:07:05 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Fri, 3 Oct 2008 20:07:05 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (windows-nt) Cancel-Lock: sha1:S4DgOy3rBJtMjM8ViGeiRAFqfXM= Original-Xref: news.stanford.edu gnu.emacs.help:163002 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58342 Archived-At: Paul R 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 =================================================