* Re: how to position cursor at top/middle/bottom of the current screen?
[not found] <mailman.624.1223507380.25473.help-gnu-emacs@gnu.org>
@ 2008-10-08 23:42 ` Chris McMahan
2008-11-03 9:25 ` Xavier Maillard
[not found] ` <mailman.2762.1225711680.25473.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: Chris McMahan @ 2008-10-08 23:42 UTC (permalink / raw)
To: help-gnu-emacs
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" <david.k.lam1@gmail.com> 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
=================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-03 13:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.624.1223507380.25473.help-gnu-emacs@gnu.org>
2008-10-08 23:42 ` how to position cursor at top/middle/bottom of the current screen? Chris McMahan
2008-11-03 9:25 ` Xavier Maillard
[not found] ` <mailman.2762.1225711680.25473.help-gnu-emacs@gnu.org>
2008-11-03 13:29 ` Richard Riley
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).