From: Matthew Flaschen <matthew.flaschen@gatech.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Alt-v behavior near beginning of buffer
Date: Thu, 25 Jan 2007 10:46:56 -0500 [thread overview]
Message-ID: <45B8D0F0.2030408@gatech.edu> (raw)
In-Reply-To: <ep9qq6$pih$1@sea.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 1107 bytes --]
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 )
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
next prev parent reply other threads:[~2007-01-25 15:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-25 1:13 Alt-v behavior near beginning of buffer Matthew Flaschen
2007-01-25 8:47 ` Kevin Rodgers
2007-01-25 15:46 ` Matthew Flaschen [this message]
2007-01-25 15:57 ` Matthew Flaschen
2007-01-26 0:25 ` Matthew Flaschen
2007-01-30 6:00 ` Kevin Rodgers
2007-01-30 15:59 ` Matthew Flaschen
2007-01-31 5:10 ` Kevin Rodgers
2007-01-31 6:29 ` Matthew Flaschen
2007-01-30 6:07 ` Kevin Rodgers
2007-01-30 16:02 ` Matthew Flaschen
[not found] <mailman.3548.1169687602.2155.help-gnu-emacs@gnu.org>
2007-01-27 5:40 ` Eric Eide
2007-01-27 7:36 ` Matthew Flaschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45B8D0F0.2030408@gatech.edu \
--to=matthew.flaschen@gatech.edu \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).