[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to move the cursor to the bottom of the screen?

From: Stefan Kamphausen
Subject: Re: How to move the cursor to the bottom of the screen?
Date: Thu, 10 Jan 2008 17:06:29 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

"Ye ilho" <> 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 ()
  (if (not (bolp))
    (if (eq this-command last-command)
         ((not (= (point) (window-start)))
          (move-to-window-line 0)
          (goto-char (point-min)))))))

(defun chb-end ()
  (if (not (eolp))
    (if (eq this-command last-command)
         ((not (= (point) (save-excursion
                            (move-to-window-line -1)
          (move-to-window-line -1)
          (goto-char (point-max)))))))

I bind them like this:
(global-set-key '[(home)] 'chb-home)
(global-set-key '[(end)]  'chb-end)

Very convenient.

Stefan Kamphausen ---
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]