Kevin Rodgers wrote: > Matthew Flaschen wrote: >> I am trying to figure out how to create a new function that will scroll >> up a screen if possible, or go the beginning of the buffer otherwise; I >> would then bind this to M-v. Ultimately, I want to have the corollary >> behavior for C-v. >> >> I can't figure out how to test whether it is possible to scroll up/down >> an entire screen. I found (goto-char (point-min/max)) , so that part >> should be okay. > > (if (pos-visible-in-window-p (point-min)) > (beginning-of-buffer) > (scroll-down)) > Thanks, that was what I needed. I ended up with: (defun power-top () "Scrolls up a screen if possible, or goes to the top of the buffer" (interactive) (if (pos-visible-in-window-p (point-min)) (goto-char (point-min)) (scroll-down))) (defun power-bottom () "Scrolls up a screen if possible, or goes to the top of the buffer" (interactive) (if (pos-visible-in-window-p (point-max)) (goto-char (point-max)) (scroll-up))) (global-set-key [?\M-v] 'power-top ) (global-set-key [?\C-v] 'power-bottom )