From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Flaschen Newsgroups: gmane.emacs.help Subject: Re: Alt-v behavior near beginning of buffer Date: Thu, 25 Jan 2007 10:46:56 -0500 Message-ID: <45B8D0F0.2030408@gatech.edu> References: <45B80425.2070209@gatech.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1420461167==" X-Trace: sea.gmane.org 1169740056 22215 80.91.229.12 (25 Jan 2007 15:47:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Jan 2007 15:47:36 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 25 16:47:27 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HA6ov-0001Z5-Ug for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jan 2007 16:47:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HA6ov-0002kv-7U for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jan 2007 10:47:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HA6oh-0002io-72 for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 10:47:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HA6oe-0002ge-TF for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 10:47:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HA6oe-0002gU-Kc for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 10:47:08 -0500 Original-Received: from deliverator5.gatech.edu ([130.207.165.165]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1HA6oe-000431-7H for help-gnu-emacs@gnu.org; Thu, 25 Jan 2007 10:47:08 -0500 Original-Received: from deliverator5.gatech.edu (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id D49BC1D19EA for ; Thu, 25 Jan 2007 10:47:06 -0500 (EST) (envelope-from matthew.flaschen@gatech.edu) Original-Received: from mailprx2.gatech.edu (mailprx2.prism.gatech.edu [130.207.171.21]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "smtp.mail.gatech.edu", Issuer "RSA Data Security, Inc." (verified OK)) by deliverator5.gatech.edu (Postfix) with ESMTP id AAE1F1D1A01 for ; Thu, 25 Jan 2007 10:47:04 -0500 (EST) (envelope-from matthew.flaschen@gatech.edu) Original-Received: from [128.61.73.81] (r73h81.res.gatech.edu [128.61.73.81]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (sasl: method=PLAIN, username=mflaschen3@mailprx2.gatech.edu, sender=n/a) by mailprx2.gatech.edu (Postfix) with ESMTP id 7CC632391 for ; Thu, 25 Jan 2007 10:47:04 -0500 (EST) (envelope-from matthew.flaschen@gatech.edu) User-Agent: Thunderbird 1.5.0.9 (X11/20070103) In-Reply-To: X-Enigmail-Version: 0.94.1.2 X-GT-Spam-Rating: (7%) X-GT-Spam-Details: No antispam rules were triggered by this message X-GT-AVAS-Version: 5.2.1.279297, Antispam-Engine: 2.4.0.264935, Antispam-Data: 2007.1.25.73432 X-detected-kernel: Solaris 9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:40641 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============1420461167== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigE0335C3645A3D1CB91E1FC2F" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE0335C3645A3D1CB91E1FC2F Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Kevin Rodgers wrote: > Matthew Flaschen wrote: >> I am trying to figure out how to create a new function that will scrol= l >> 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/dow= n >> an entire screen. I found (goto-char (point-min/max)) , so that part >> should be okay. >=20 > (if (pos-visible-in-window-p (point-min)) > (beginning-of-buffer) > (scroll-down)) >=20 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 ) --------------enigE0335C3645A3D1CB91E1FC2F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFuND1Q5LSyju97VkRApqqAJ0cCM8AedwXcNNTkKyCAnE298TSgQCgqc5F jafbHIqwYpXS4UUBDPiWk+E= =Sv6K -----END PGP SIGNATURE----- --------------enigE0335C3645A3D1CB91E1FC2F-- --===============1420461167== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --===============1420461167==--