home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.emacs.help
- Path: sparky!uunet!usc!cs.utexas.edu!torn!cunews!nrcnet0!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: Hamish.Macdonald@x400gate.bnr.ca's message of Wed, 09 Sep 92 19:28:05 GMT
- Message-ID: <1992Sep10.135545.26512@bmerh85.bnr.ca>
- Lines: 32
- Sender: news@bmerh85.bnr.ca (Usenet News)
- Organization: Bell Northern Research
- References: <1992Sep09.183531.5615@bnr.ca> <1992Sep09.192805.12394@bmerh85.bnr.ca>
- Date: Thu, 10 Sep 92 13:55:45 GMT
-
- >>>>> On Wed, 09 Sep 92 19:28:05 GMT,
- >>>>> In message <1992Sep09.192805.12394@bmerh85.bnr.ca>,
- >>>>> I wrote:
-
- [some top-of-window, middle-of-window, and bottom-of-window functions
- which won't work in emacs 18.58 for one thing, and are buggy to boot]
-
- It seems that the "window-end" I used is from Lucid Emacs 19, and not
- available in emacs 18.
-
- Here is a replacement which seems to work:
-
- (defun window-end (&optional window)
- "Return position at which display currently ends in WINDOW."
- (save-excursion
- (goto-char (window-start window))
- (forward-line (- (window-height window) 2))
- (end-of-line)
- (point)))
-
- Also, the middle-of-window function only works if the top of the
- window is the beginning of the buffer :-)
-
- Here is one which seems to work:
-
- (defun middle-of-window()
- "Go to middle line of window"
- (interactive)
- (goto-char (+ (window-start) (/ (- (window-end) (window-start)) 2)))
- (beginning-of-line))
-
- No warranty.
-