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 to position cursor at top/middle/bottom of the current screen? Date: Wed, 08 Oct 2008 19:42:03 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <7shc7m64dw.fsf@one.net> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1223526157 26610 80.91.229.12 (9 Oct 2008 04:22:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Oct 2008 04:22:37 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 09 06:23:34 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 1Knn3l-0003F9-Ry for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Oct 2008 06:23:34 +0200 Original-Received: from localhost ([127.0.0.1]:48231 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Knn2h-0001zx-Vl for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Oct 2008 00:22:27 -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: 56 Original-NNTP-Posting-Host: panix5.panix.com Original-X-Trace: reader1.panix.com 1223509299 10095 166.84.1.5 (8 Oct 2008 23:41:39 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Wed, 8 Oct 2008 23:41:39 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (windows-nt) Cancel-Lock: sha1:CejSB/T+KWELRZjO/DXJdL8ZYsc= Original-Xref: news.stanford.edu gnu.emacs.help:163245 X-Mailman-Approved-At: Thu, 09 Oct 2008 00:19:44 -0400 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:58600 Archived-At: I've been using this function for many years. It cycles the current cursor and text position from the middle to the top then to the bottom of the screen and back. Just hit C-l repeatedly to change position. I think this is what you're looking for... - Chris ;;;====================================================================== ;;; modify the buffer centering command C-l ;; (thanks to Michael.Luetzeler@unibw-muenchen.de) (defun cm-recenter-display (arg) "Move point in window and redisplay screen. First time, leaves point in the middle of the window. Second time, leaves point near top of window. Third time, leaves point near bottom of window. With just one \\[universal-argument] arg, redraw screen without moving point. With numeric arg, redraw around that line." (interactive "P") (cond ((consp arg) (recenter) (recenter line));; (redraw-display) bombs in Epoch 3.1. (arg (recenter (prefix-numeric-value arg))) ((eq last-command 'recenter-first) (setq this-command 'recenter-second) (recenter 1)) ((eq last-command 'recenter-second) (setq this-command nil) (recenter -2)) (t (setq this-command 'recenter-first) (recenter nil)))) (global-set-key "\C-l" 'cm-recenter-display) ;;;====================================================================== - Chris "David Lam" writes: > like... theres M-< and M->, but those move to the cursor to the very > top/bottom of the file > > i wanna just move the cursor relative to the current text on the > screen... is there a built-in function for this? > -- (. .) =ooO=(_)=Ooo===================================== Chris McMahan | first_initiallastname@one.dot.net =================================================