From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pavol Murin" Newsgroups: gmane.emacs.help Subject: Re: make ctrl+v (page-down) move even when near the end of document Date: Thu, 3 Apr 2008 10:30:31 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1207211464 2803 80.91.229.12 (3 Apr 2008 08:31:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Apr 2008 08:31:04 +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 Apr 03 10:31:36 2008 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 1JhKr7-0001YS-90 for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Apr 2008 10:31:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhKqU-0006JX-HB for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Apr 2008 04:30:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JhKqA-0006Fy-H0 for help-gnu-emacs@gnu.org; Thu, 03 Apr 2008 04:30:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JhKq9-0006El-5l for help-gnu-emacs@gnu.org; Thu, 03 Apr 2008 04:30:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhKq8-0006Eb-Uq for help-gnu-emacs@gnu.org; Thu, 03 Apr 2008 04:30:33 -0400 Original-Received: from wr-out-0506.google.com ([64.233.184.226]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JhKq8-00017R-JJ for help-gnu-emacs@gnu.org; Thu, 03 Apr 2008 04:30:32 -0400 Original-Received: by wr-out-0506.google.com with SMTP id 57so2382886wri.12 for ; Thu, 03 Apr 2008 01:30:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=b3P2TifRvsQkbiNmXg7qWvGQXXA8Vic12yRxuMhhuQk=; b=ksa8FImzzxGvXiqS4j/WNFxriJub0tHLRBp4oRQ8UsUnXKhdfpBl1wo+rpO12lILKqY4EilrRsJn0VTSDMJ2EQbeBgkD3cIvZbqOKX5sW0rOQ2G54x4YIgYBVqH1vjgJngaPk9x6kU5Cr6IuWF2mlMg2fyGBB8Mg57Bs8P4xiQA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=JvpxG9PJT+SjS2uBOmnK1aZYAimaL5GBc0aZNUlfpyJ3gYUe3uiG1bAcXanLZVMrgsvCRT1nBKbLYlkTI3hsjljhFML3qwH0/KVetSXuYATvZfsabE0TwUhX+B4siaSTj69qOJaGv23XnA1Hl5ldx6LbCQzwR2L7fyeJQImPMW0= Original-Received: by 10.151.108.19 with SMTP id k19mr283196ybm.191.1207211431839; Thu, 03 Apr 2008 01:30:31 -0700 (PDT) Original-Received: by 10.151.11.1 with HTTP; Thu, 3 Apr 2008 01:30:31 -0700 (PDT) Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:53005 Archived-At: On Apr 2, 6:57 pm, "Lennart Borgman (gmail)" wrote: > B. T. Raven wrote: > > Pavol Murin wrote: > >> hello fellow emacs users, > >> I would like to makectrl+vlike page-down (and page-up) do in other > >> applications when near the beginning or end of the document. This > >> means that when the point cannot move by a full page, it moves to the > >> first or last position in the document. I can program it in elisp, but > >> there might be a simpler solution (maybe a different function to > >> bind)? > > >> thanks, muro > > > The pertinent code that would have to be hacked is in window.c and the > > only other candidate I see is the variable next-screen-context-lines, > > also in window.c Maybe if you can make a good case for the usefulness > > of this behavior, someone will change the code for you. Out of > > curiosity, why do you care if the cursor is exactly at top or bottom of > > buffer as long as you can see the text there. muscle memory - using it like that in windows applications for 10+ years. > > Immediately after the last > > M-v or C-v you can M-< or M-> if you need extreme cursor movement. that's exactly what I want the command to do :-) > > cua-mode has the code for this. It is however bound to PgUp/Down. where can I find this code? I had a look at cua-base.el, cua-gmrk.el and cua-rect.el and couldn't find it. > > Ed I couldn't get (scroll-down) to work in lisp, when I was near the beginning of buffer, then found condition-case. The final scrolling function is now 8 lines in each direction: (defun scroll-down-to-point-min () (interactive) (let ((curr (window-start))) (condition-case () (scroll-down) (error nil)) (if (and (eq curr (window-start)) (/= (point) (point-min))) (goto-char (point-min))))) (defun scroll-up-to-point-max () (interactive) (let ((curr (window-start))) (condition-case () (scroll-up) (error nil)) (if (and (eq curr (window-start)) (/= (point) (point-max))) (goto-char (point-max))))) (global-set-key [prior] 'scroll-down-to-point-min) (global-set-key [next] 'scroll-up-to-point-max) thanks for all hints, muro