[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Alt-v behavior near beginning of buffer
From: |
Matthew Flaschen |
Subject: |
Re: Alt-v behavior near beginning of buffer |
Date: |
Thu, 25 Jan 2007 10:46:56 -0500 |
User-agent: |
Thunderbird 1.5.0.9 (X11/20070103) |
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 )
signature.asc
Description: OpenPGP digital signature
- Alt-v behavior near beginning of buffer, Matthew Flaschen, 2007/01/24
- Re: Alt-v behavior near beginning of buffer, Kevin Rodgers, 2007/01/25
- Re: Alt-v behavior near beginning of buffer,
Matthew Flaschen <=
- Re: Alt-v behavior near beginning of buffer, Matthew Flaschen, 2007/01/25
- Re: Alt-v behavior near beginning of buffer, Matthew Flaschen, 2007/01/25
- Re: Alt-v behavior near beginning of buffer, Kevin Rodgers, 2007/01/30
- Re: Alt-v behavior near beginning of buffer, Matthew Flaschen, 2007/01/30
- Re: Alt-v behavior near beginning of buffer, Kevin Rodgers, 2007/01/31
- Re: Alt-v behavior near beginning of buffer, Matthew Flaschen, 2007/01/31
- Re: Alt-v behavior near beginning of buffer, Kevin Rodgers, 2007/01/30
- Re: Alt-v behavior near beginning of buffer, Matthew Flaschen, 2007/01/30