From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: scroll-top-bottom (was: delete-selection-mode) Date: Sat, 20 Mar 2010 03:34:59 +0200 Organization: JURTA Message-ID: <878w9nn4el.fsf_-_@mail.jurta.org> References: <87ocitw2dl.fsf@stupidchicken.com> <201003130001.o2D01FFQ003489@godzilla.ics.uci.edu> <87vdd1yqe4.fsf@stupidchicken.com> <87eijjzrkd.fsf_-_@mail.jurta.org> <8BDB38B3CCBC481CB014CB3DA9FA1948@us.oracle.com> <87y6hq39rk.fsf_-_@mail.jurta.org> <9B30E5E474524F4092443C23D37B92CC@us.oracle.com> <8739zxgx0v.fsf@gnu.org> <87zl25e31f.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1269050361 26567 80.91.229.12 (20 Mar 2010 01:59:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 20 Mar 2010 01:59:21 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 20 02:59:17 2010 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.69) (envelope-from ) id 1Nsny7-0004As-Up for ged-emacs-devel@m.gmane.org; Sat, 20 Mar 2010 02:59:16 +0100 Original-Received: from localhost ([127.0.0.1]:43888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nsny7-0002b7-9I for ged-emacs-devel@m.gmane.org; Fri, 19 Mar 2010 21:59:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nsny0-0002ar-M8 for emacs-devel@gnu.org; Fri, 19 Mar 2010 21:59:08 -0400 Original-Received: from [140.186.70.92] (port=38282 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nsnxy-0002aj-AQ for emacs-devel@gnu.org; Fri, 19 Mar 2010 21:59:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nsnxw-0005ql-En for emacs-devel@gnu.org; Fri, 19 Mar 2010 21:59:06 -0400 Original-Received: from smtp-out2.starman.ee ([85.253.0.4]:42281 helo=mx2.starman.ee) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nsnxw-0005qf-5L for emacs-devel@gnu.org; Fri, 19 Mar 2010 21:59:04 -0400 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Original-Received: from mail.starman.ee (82.131.94.132.cable.starman.ee [82.131.94.132]) by mx2.starman.ee (Postfix) with ESMTP id 44E6B3F4108 for ; Sat, 20 Mar 2010 03:58:56 +0200 (EET) In-Reply-To: <87zl25e31f.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 18 Mar 2010 23:23:44 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:122326 Archived-At: >> The pc-select-override-scroll-error feature is something more. > > I think it should be moved to simple.el since it is not directly related > to pc-select and is useful globally outside of pc-select. This feature is implemented by CUA mode, but it would be very useful for users who don't use CUA. To support it in the core, I've implemented a new user option `scroll-top-bottom' (that defines the scrolling behavior at the top/bottom of the buffer). If this is better to implement in Lisp, then `scroll-up' and `scroll-down' should be moved from window.c to window.el. === modified file 'lisp/emulation/pc-select.el' --- lisp/emulation/pc-select.el 2010-03-12 17:47:22 +0000 +++ lisp/emulation/pc-select.el 2010-03-19 23:59:44 +0000 @@ -93,6 +93,9 @@ (defcustom pc-select-override-scroll-err errors are suppressed." :type 'boolean :group 'pc-select) +(define-obsolete-variable-alias 'pc-select-override-scroll-error + 'scroll-top-bottom + "24.1") (defcustom pc-select-selection-keys-only nil "*Non-nil means only bind the basic selection keys when started. === modified file 'lisp/cus-start.el' --- lisp/cus-start.el 2010-01-13 08:35:10 +0000 +++ lisp/cus-start.el 2010-03-19 23:55:19 +0000 @@ -306,6 +306,12 @@ (let ((all '(;; alloc.c (const :tag "Off (nil)" :value nil) (const :tag "Full screen (t)" :value t) (other :tag "Always" 1)) "22.1") + (scroll-top-bottom + windows (choice + (const :tag "Off (nil)" :value nil) + (other :tag "Move to top/bottom (t)" :value t)) + "24.1") (recenter-redisplay windows (choice (const :tag "Never (nil)" :value nil) === modified file 'src/window.c' --- src/window.c 2010-01-13 08:35:10 +0000 +++ src/window.c 2010-03-19 23:57:16 +0000 @@ -168,6 +168,11 @@ (at your option) any later version. Lisp_Object Vscroll_preserve_screen_position; +/* Non-nil means scroll commands move point to top/bottom of buffer + before signalling an error. */ + +Lisp_Object Vscroll_top_bottom; + /* Non-nil means that text is inserted before window's markers. */ Lisp_Object Vwindow_point_insertion_type; @@ -5014,7 +5019,12 @@ - it.current_y + it.max_ascent + it.max_descent); adjust_glyphs (it.f); } - else if (noerror) + else if (!NILP (Vscroll_top_bottom) && PT < ZV) + { + SET_PT (ZV); + return; + } + else if (noerror) return; else if (n < 0) /* could happen with empty buffers */ xsignal0 (Qbeginning_of_buffer); @@ -5027,7 +5037,12 @@ /* The first line was only partially visible, make it fully visible. */ w->vscroll = 0; - else if (noerror) + else if (!NILP (Vscroll_top_bottom) && PT > BEGV) + { + SET_PT (BEGV); + return; + } + else if (noerror) return; else xsignal0 (Qbeginning_of_buffer); @@ -5242,7 +5257,12 @@ if (lose) { - if (noerror) + if (!NILP (Vscroll_top_bottom) && PT > BEGV) + { + SET_PT (BEGV); + return; + } + else if (noerror) return; else xsignal0 (Qbeginning_of_buffer); @@ -5328,7 +5348,12 @@ } else { - if (noerror) + if (!NILP (Vscroll_top_bottom) && PT < ZV) + { + SET_PT (ZV); + return; + } + else if (noerror) return; else xsignal0 (Qend_of_buffer); @@ -7268,6 +7293,15 @@ Any other value means point always keeps its screen position. */); Vscroll_preserve_screen_position = Qnil; + DEFVAR_LISP ("scroll-top-bottom", + &Vscroll_top_bottom, + doc: /* Controls if scroll commands move point to the top/bottom of the buffer. +A value of nil means just signal an error if no more scrolling possible. +A value of t means point moves to the beginning or the end of the buffer +(depending on scrolling direction) when no more scrolling possible. +When point is already on that position, then signal an error. */); + Vscroll_top_bottom = Qnil; + DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, doc: /* Type of marker to use for `window-point'. */); Vwindow_point_insertion_type = Qnil; -- Juri Linkov http://www.jurta.org/emacs/