|
From: | Sanjeev Kumar.S |
Subject: | emacs crash again and again......I'm requesting help here as last resort. |
Date: | Sat, 12 Jan 2008 11:32:19 -0800 (PST) |
"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 ()
(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.
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
[Prev in Thread] | Current Thread | [Next in Thread] |