home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / gnu / emacs / help / 4071 < prev    next >
Encoding:
Text File  |  1992-09-10  |  2.2 KB  |  61 lines

  1. Newsgroups: gnu.emacs.help
  2. Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!corpgate!bnrgate!bmerh85!bmerh85!hamish
  3. From: Hamish.Macdonald@x400gate.bnr.ca (Hamish Macdonald)
  4. Subject: Re: Equivalents to vi's H, M, L Commands?
  5. In-Reply-To: epstein@sparc9.cs.uiuc.edu's message of Thu, 10 Sep 1992 15:43:53 GMT
  6. Message-ID: <1992Sep10.164525.29696@bmerh85.bnr.ca>
  7. Lines: 46
  8. Sender: news@bmerh85.bnr.ca (Usenet News)
  9. Organization: Bell Northern Research
  10. References: <1992Sep09.183531.5615@bnr.ca> <1992Sep09.192805.12394@bmerh85.bnr.ca>
  11.     <1992Sep10.135545.26512@bmerh85.bnr.ca>
  12.     <1992Sep10.154353.28044@sunb10.cs.uiuc.edu>
  13. Date: Thu, 10 Sep 92 16:45:25 GMT
  14.  
  15. >>>>> On Thu, 10 Sep 1992 15:43:53 GMT,
  16. >>>>> In message <1992Sep10.154353.28044@sunb10.cs.uiuc.edu>,
  17. >>>>> epstein@sparc9.cs.uiuc.edu (Milt Epstein) wrote:
  18.  
  19. Milt> Uh, am I missing something, i.e. is there any reason these
  20. Milt> things need to be so complicated?  Won't the following work just
  21. Milt> fine:
  22.  
  23. Milt>      home (or top):     C-u 0 C-l
  24. Milt>      middle:            C-u C-l (or just C-l)
  25. Milt>      last (or bottom):  C-u -1 C-l 
  26.  
  27. Milt> C-l is by default bound to recenter, which optionally takes a
  28. Milt> prefix argument that indicates which window line to place the
  29. Milt> current line at.  Negative numbers count up from the bottom.
  30.  
  31. These change what is displayed in the window, rather than just moving
  32. point as Michael wanted.
  33.  
  34. Milt> (I might as well point out the "inverse" function,
  35. Milt> move-to-window-line, which similarly takes prefix arguments, and
  36. Milt> which isn't by default bound to any key.)
  37.  
  38. Ah.... I should have found this.  top-of-window, bottom-of-window and
  39. middle-of-window can easily be rewritten to take advantage of this
  40. function.
  41.  
  42. You could use the prefix argument to move-to-window-line, but having
  43. separate commands make it easy to bind keys to the different commands.
  44.  
  45. (defun top-of-window ()
  46.     "move point to first line of window"
  47.     (interactive)
  48.     (move-to-window-line 0))
  49.  
  50. (defun bottom-of-window ()
  51.     "move point to last line of window"
  52.     (interactive)
  53.     (move-to-window-line -1))
  54.  
  55. (defun middle-of-window ()
  56.     "move point to middle line of window"
  57.     (interactive)
  58.     (move-to-window-line nil))
  59.  
  60. This is my last posting on this subject :-)
  61.