From: Stefan Kamphausen <skampi@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: Re: How to move the cursor to the bottom of the screen?
Date: Thu, 10 Jan 2008 17:06:29 +0100 [thread overview]
Message-ID: <85zlvdpsvu.fsf@usenet.my.skamphausen.de> (raw)
In-Reply-To: mailman.5929.1199901491.18990.help-gnu-emacs@gnu.org
"Ye ilho" <iy2110@columbia.edu> writes:
> Hi everyone,
>
> I am sorry for my ignorance but I was trying to find out how to move
> the cursor to the bottom/middle/top of the screen?
> In other words, when I edit something, I sometimes want to go to the
> top of the screen I see with one key stroke.
There are two functions I've been using for years which allow me to
use the home and end keys as follows:
press once goto beginning/end of line
press twice goto beginning/end of window
press thrice goto beginning/end of buffer
Those functions are:
(defun chb-home ()
(interactive)
(if (not (bolp))
(beginning-of-line)
(if (eq this-command last-command)
(cond
((not (= (point) (window-start)))
(move-to-window-line 0)
(beginning-of-line))
(t
(goto-char (point-min)))))))
(defun chb-end ()
(interactive)
(if (not (eolp))
(end-of-line)
(if (eq this-command last-command)
(cond
((not (= (point) (save-excursion
(move-to-window-line -1)
(end-of-line)
(point))))
(move-to-window-line -1)
(end-of-line))
(t
(goto-char (point-max)))))))
I bind them like this:
(global-set-key '[(home)] 'chb-home)
(global-set-key '[(end)] 'chb-end)
Very convenient.
Regards,
Stefan
--
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.
next prev parent reply other threads:[~2008-01-10 16:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5929.1199901491.18990.help-gnu-emacs@gnu.org>
2008-01-09 19:01 ` How to move the cursor to the bottom of the screen? Exal de Jesus Garcia Carrillo
2008-01-10 16:06 ` Stefan Kamphausen [this message]
2008-01-12 19:32 ` emacs crash again and again......I'm requesting help here as last resort Sanjeev Kumar.S
2008-01-09 17:58 How to move the cursor to the bottom of the screen? Ye ilho
2008-01-09 18:44 ` B. Smith-Mannschott
2008-01-09 19:07 ` Ye ilho
2008-01-09 19:15 ` Lennart Borgman (gmail)
2008-01-09 19:23 ` Ye ilho
2008-01-10 8:15 ` Alan Mackenzie
2008-01-10 9:32 ` Thierry Volpiatto
[not found] ` <mailman.5934.1199906623.18990.help-gnu-emacs@gnu.org>
2008-01-09 22:48 ` Barry Margolin
2008-01-10 4:34 ` Sanjeev Kumar.S
2008-01-10 9:05 ` Dmitri Minaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85zlvdpsvu.fsf@usenet.my.skamphausen.de \
--to=skampi@gmx.net \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).