home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.emacs.help
- Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!corpgate!bnrgate!bmerh85!bmerh85!hamish
- From: Hamish.Macdonald@x400gate.bnr.ca (Hamish Macdonald)
- Subject: Re: Equivalents to vi's H, M, L Commands?
- In-Reply-To: epstein@sparc9.cs.uiuc.edu's message of Thu, 10 Sep 1992 15:43:53 GMT
- Message-ID: <1992Sep10.164525.29696@bmerh85.bnr.ca>
- Lines: 46
- Sender: news@bmerh85.bnr.ca (Usenet News)
- Organization: Bell Northern Research
- References: <1992Sep09.183531.5615@bnr.ca> <1992Sep09.192805.12394@bmerh85.bnr.ca>
- <1992Sep10.135545.26512@bmerh85.bnr.ca>
- <1992Sep10.154353.28044@sunb10.cs.uiuc.edu>
- Date: Thu, 10 Sep 92 16:45:25 GMT
-
- >>>>> On Thu, 10 Sep 1992 15:43:53 GMT,
- >>>>> In message <1992Sep10.154353.28044@sunb10.cs.uiuc.edu>,
- >>>>> epstein@sparc9.cs.uiuc.edu (Milt Epstein) wrote:
-
- Milt> Uh, am I missing something, i.e. is there any reason these
- Milt> things need to be so complicated? Won't the following work just
- Milt> fine:
-
- Milt> home (or top): C-u 0 C-l
- Milt> middle: C-u C-l (or just C-l)
- Milt> last (or bottom): C-u -1 C-l
-
- Milt> C-l is by default bound to recenter, which optionally takes a
- Milt> prefix argument that indicates which window line to place the
- Milt> current line at. Negative numbers count up from the bottom.
-
- These change what is displayed in the window, rather than just moving
- point as Michael wanted.
-
- Milt> (I might as well point out the "inverse" function,
- Milt> move-to-window-line, which similarly takes prefix arguments, and
- Milt> which isn't by default bound to any key.)
-
- Ah.... I should have found this. top-of-window, bottom-of-window and
- middle-of-window can easily be rewritten to take advantage of this
- function.
-
- You could use the prefix argument to move-to-window-line, but having
- separate commands make it easy to bind keys to the different commands.
-
- (defun top-of-window ()
- "move point to first line of window"
- (interactive)
- (move-to-window-line 0))
-
- (defun bottom-of-window ()
- "move point to last line of window"
- (interactive)
- (move-to-window-line -1))
-
- (defun middle-of-window ()
- "move point to middle line of window"
- (interactive)
- (move-to-window-line nil))
-
- This is my last posting on this subject :-)
-