From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Adrian Robert Newsgroups: gmane.emacs.devel Subject: "Pager" page-up and -down, why not merge? Date: Tue, 3 Jun 2008 16:57:38 -0400 Message-ID: <5896C8E2-D065-4B8E-927F-8784062241EF@interstitiality.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v924) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1212526698 31729 80.91.229.12 (3 Jun 2008 20:58:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Jun 2008 20:58:18 +0000 (UTC) To: emacs- devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 03 22:58:59 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K3das-00064C-LA for ged-emacs-devel@m.gmane.org; Tue, 03 Jun 2008 22:58:58 +0200 Original-Received: from localhost ([127.0.0.1]:55360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3da6-0007pz-AX for ged-emacs-devel@m.gmane.org; Tue, 03 Jun 2008 16:58:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K3da0-0007mk-W7 for emacs-devel@gnu.org; Tue, 03 Jun 2008 16:58:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K3da0-0007lP-41 for emacs-devel@gnu.org; Tue, 03 Jun 2008 16:58:04 -0400 Original-Received: from [199.232.76.173] (port=35596 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3dZz-0007lE-Ux for emacs-devel@gnu.org; Tue, 03 Jun 2008 16:58:04 -0400 Original-Received: from theta.genwebserver.com ([72.18.148.146]:52070) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K3dZz-0004T6-IQ for emacs-devel@gnu.org; Tue, 03 Jun 2008 16:58:04 -0400 Original-Received: from [97.73.30.9] (helo=[192.168.10.101]) by theta.genwebserver.com with esmtpa (Exim 4.68) (envelope-from ) id 1K3dZw-0006Z4-Gg for emacs-devel@gnu.org; Tue, 03 Jun 2008 14:58:03 -0600 X-Mailer: Apple Mail (2.924) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - theta.genwebserver.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - interstitiality.net X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98334 Archived-At: Hello, The "pager" commands at: http://user.it.uu.se/~mic/pager.el seem to be an improvement over the existing definitions of scroll-down and scroll-up in emacs. In particular, hitting sequences like [next] or Ctrl-v followed by [previous] or M-v leaves point in the same place, which is very calming. ;-) Is there any reason these could not be incorporated into emacs to replace scroll-up and scroll-down in these bindings? It was discussed before with no conclusion: http://article.gmane.org/gmane.emacs.devel/40324/match=pager http://article.gmane.org/gmane.emacs.devel/69511/match=pager+el I'm including below an improved version of this lisp that is used in Emacs.app. ---------------------- ;;; page-down,page-up etc. leaves cursor in same place ;;; modified (ABR) from pager.el --- windows-scroll commands ;;; Version 2.0 - 97-10-06 ;;; Copyright (C) 1992-1997 Mikael Sjodin (mic@docs.uu.se) ;;; http://user.it.uu.se/~mic/emacs.shtml (defvar pager-temporary-goal-column 0 "Similar to temporary-goal-column but used by the pager.el functions") ;(make-variable-buffer-local 'pager-temporary-goal-column) (defconst pager-keep-column-commands '(pager-row-down pager-row-up row-dn row-up pager-page-down pager-page-up pg-dn pg-up) "Commands which when called without any other intervening command should keep the `pager-temporary-goal-column'") (defun pager-page-down () "Like scroll-up, but moves a fixed amount of lines (fixed relative the `window-text-height') so that pager-page-up moves back to the same line." (interactive) (if (not (pos-visible-in-window-p (point-max))) (pager-scroll-screen (- (window-text-height) next-screen-context-lines)))) (defun pager-page-up () "Like scroll-down, but moves a fixed amount of lines (fixed relative the `window-text-height') so that pager-page-down moves back to the same line." (interactive) (if (not (pos-visible-in-window-p (point-min))) (pager-scroll-screen (- next-screen-context-lines (window-text-height))))) (defun pager-scroll-screen (lines) "Scroll screen LINES, but keep the cursors position on screen." (if (not (memq last-command pager-keep-column-commands)) (setq pager-temporary-goal-column (current-column))) (save-excursion (goto-char (window-start)) (vertical-motion lines) (set-window-start (selected-window) (point))) (vertical-motion lines) (move-to-column pager-temporary-goal-column)) (global-set-key "\C-v" 'pager-page-down) (global-set-key [next] 'pager-page-down) (global-set-key "\ev" 'pager-page-up) (global-set-key [prior] 'pager-page-up)