From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Livin Stephen 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: Sat, 4 Oct 2008 14:24:08 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7369ef97-1a0b-40a4-9337-070e665d5d5f@w39g2000prb.googlegroups.com> References: <7sod21hf0r.fsf@one.dot.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1223156453 2390 80.91.229.12 (4 Oct 2008 21:40:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Oct 2008 21:40:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 04 23:41:50 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 1KmEsl-0002Ft-MA for geh-help-gnu-emacs@m.gmane.org; Sat, 04 Oct 2008 23:41:47 +0200 Original-Received: from localhost ([127.0.0.1]:50617 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KmEri-0000WK-0A for geh-help-gnu-emacs@m.gmane.org; Sat, 04 Oct 2008 17:40:42 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!w39g2000prb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: 117.192.226.140 Original-X-Trace: posting.google.com 1223155448 2526 127.0.0.1 (4 Oct 2008 21:24:08 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 4 Oct 2008 21:24:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w39g2000prb.googlegroups.com; posting-host=117.192.226.140; posting-account=Q30uoQoAAACDL2O2xg4pWJiNoqIIeAyv User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:163024 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:58365 Archived-At: On Oct 3, 9:09=A0pm, Paul R wrote: > 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 () > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(interactive) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(next-line 1) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unless (eq (window-en= d) (point-max)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(scroll-up 1)))) > (global-set-key [up] (lambda () > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(interactive) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(previous-line 1) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unless (eq (window-start)= (point-min)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(scroll-down 1)))) > > -- > =A0 Paul The initial request from David Lam was for scrolling-in-place such that the cursor remained "in place" with respect to the text - not with respect to the frame/window. In VI, C-e (C-y is the counterpart), 1. scrolls the page up by line, AND 2. moves the up cursor ALSO by one line - so that it stays at the same character at which it was originally. In the lisp examples (thanks for them!), I commented out "(previous- line 1)" and "(next-line 1)" to achieve this. I *do* also like what your original lisp samples do.