Path: utzoo!attcan!uunet!yale!spolsky-joel From: spolsky-joel@CS.YALE.EDU (Joel Spolsky) Newsgroups: comp.emacs Subject: Re: assorted questions Message-ID: <39882@yale-celray.yale.UUCP> Date: 8 Oct 88 05:32:20 GMT References: <1423.590955666@pizza> <38609@yale-celray.yale.UUCP> <59@titania.warwick.ac.uk> Sender: root@yale.UUCP Reply-To: spolsky-joel@CS.YALE.EDU (Joel Spolsky) Organization: Yale University Computer Science Dept, New Haven CT 06520-2158 Lines: 54 cudcv@warwick.ac.uk (Rob McMahon) writes: | spolsky-joel@CS.YALE.EDU (Joel Spolsky) (ME!) writes: | | In article <1423.590955666@pizza| jr@bbn.com writes: | | | | 2) ... Wouldn't it make a bit more sense [if scroll-{up,down} at the | | | | limit of the file went] to the bottom (top) of the file? | | | | | | ... scroll-{up,down} move the window. point moves as a side effect, since | | | the semantics of windows require that point stay inside. | | (lots of discussion of such `semantics' deleted) OK OK enough of this. I wrote these two functions to make emacs behave like I expect it to. I like the idea of always moving the cursor a fixed number of lines better because: - page up in the "top" of the file still moves the cursor to the top line, and vice-versa - if you page several screens away to look at something, and then page back, your cursor will end up in the exact same place where you left it. Here are the functions. I bind them to C-v and M-v. They are my first in emacs-lisp so if they are a bit screwy please eMail me. ----- ;;; An attempt to rebind the page down and page up keys to behave ;;; as I expect them to, in other words, to move up(down) the number ;;; of lines in the buffer minus 1. (defun page-down (&optional arg) "Move point down a page worth of lines" (interactive "p") (next-line (if (> arg 1) (* (- (window-height) 2) arg) (- (window-height) 2)))) (defun page-up (&optional arg) "Move point up a page worth of lines" (interactive "p") (previous-line (if (> arg 1) (* (- (window-height) 2) arg) (- (window-height) 2)))) +----------------+---------------------------------------------------+ | Joel Spolsky | bitnet: spolsky@yalecs uucp: ...!yale!spolsky | | | arpa: spolsky@yale.edu voicenet: 203-436-1483 | +----------------+---------------------------------------------------+ These opinions are mine. I do not represent Yale University in any way. (Yale LIKES the way emacs scrolling works. Jeeesh.)