From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#5718: scroll-margin in buffer with small line count. Date: Mon, 30 Jan 2017 23:52:22 -0500 Message-ID: <87bmunrfuh.fsf@users.sourceforge.net> References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> <83d1fg5iku.fsf@gnu.org> <87inp7ui27.fsf@users.sourceforge.net> <83shob3rjr.fsf@gnu.org> <87inoysmxa.fsf@users.sourceforge.net> <834m0gy3ah.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1485838336 1215 195.159.176.226 (31 Jan 2017 04:52:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2017 04:52:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 31 05:52:12 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYQQN-0008SM-Tm for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Jan 2017 05:52:12 +0100 Original-Received: from localhost ([::1]:36153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYQQP-0002SL-PS for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Jan 2017 23:52:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYQQH-0002SF-KB for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 23:52:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYQQE-00060O-IV for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 23:52:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53403) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYQQE-00060E-FR for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 23:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cYQQE-00065M-15 for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 23:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Jan 2017 04:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5718 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 5718-submit@debbugs.gnu.org id=B5718.148583828223342 (code B ref 5718); Tue, 31 Jan 2017 04:52:01 +0000 Original-Received: (at 5718) by debbugs.gnu.org; 31 Jan 2017 04:51:22 +0000 Original-Received: from localhost ([127.0.0.1]:51602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYQPZ-00064Q-Rq for submit@debbugs.gnu.org; Mon, 30 Jan 2017 23:51:22 -0500 Original-Received: from mail-io0-f195.google.com ([209.85.223.195]:35762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYQPY-00064E-GD for 5718@debbugs.gnu.org; Mon, 30 Jan 2017 23:51:20 -0500 Original-Received: by mail-io0-f195.google.com with SMTP id m98so16741917iod.2 for <5718@debbugs.gnu.org>; Mon, 30 Jan 2017 20:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=51WE/nQpwEvUgQAIvx1rUELfDokyhgyvobW3HjCZDr4=; b=AdRhdRYVZ4B9Jiny65sxOcPF0OeZDY2bIMMnstdsM829JBaVsCjTQFC7/jZ2/3DhEy b1fayKlLKxMObYwrA19Fnr7XgWQmtLZXMMcrTF+p8EeocRSqtTRqogn8M0efyMMPzX2z UMVUMKTGNPL/M02DSoT5DCfvjE+u0vIk9ZOx4lfhzamfXLIh0xtOwoH2OznPEkc9ffZS wR8g/yL0If/N8IabWKZ+XktnNxoix+ey2khYNK1xNH9fJsLRxvgtnoDZ4YDxzuJcs8w+ Dqr0JGGicncVLg8nipMSAorLONbPMZFSayiuRwDy8UVSnj5DLaffmbA8VW5zTtNslN6t ziPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=51WE/nQpwEvUgQAIvx1rUELfDokyhgyvobW3HjCZDr4=; b=YGtZvHxWDqPz85CnAb1zHWm9F+T961N5cIN7XBbHIeNL603NfIqjd3w6mM3e8JEOpz EQ/JAfqSTFfLVuXhlYQzZOxVvw+/qZwuOkPPmHhPluAa8MRhAyqbuztdG2Jd9nco+3j1 +r6+AoGU0fbEajQ52PCKNV/VwbqPwr+Qm+TrEtwDHmQK3ar/4vl+Baf42zdkExyV4Wva aVGjJpCdyxsQoAyVCKR+dYNh4E7PhN/7oEwIlBpvoZQaiiJc18Fr96i8KWEA1zhFprzF 05ttR7DeA4fN6/D9l9+Galc8hyZyA4yIslGEshaj7Fz5WESV3uF0MIUvwcXbSZENen+Y OZuA== X-Gm-Message-State: AIkVDXLC2mClHpgYRaTHOHPlUPDyu9/SRYpS92tyYEsC6S1OPYDkT+uyM/2nMDi3GcxGGg== X-Received: by 10.107.148.141 with SMTP id w135mr24240903iod.229.1485838274991; Mon, 30 Jan 2017 20:51:14 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id q89sm9565459ioi.42.2017.01.30.20.51.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jan 2017 20:51:13 -0800 (PST) In-Reply-To: <834m0gy3ah.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Jan 2017 17:29:26 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128820 Archived-At: Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com >> Date: Sat, 28 Jan 2017 19:57:21 -0500 >> >> Okay, I think this is ready now, I'm posting the final patchset for >> reference. It's basically the same as the previous stuff, but I've made >> maximum-scroll-margin customizable, and renamed window-tests.el to >> test/manual/scroll-tests.el (since it only works in an interactive >> session). >> >> I'll push to master in a couple of days. > > Thanks, it LGTM. Would you mind to mention the new option in the user > manual? Oh right, forgot about that. Does this look okay? diff --git c/doc/emacs/display.texi i/doc/emacs/display.texi index c6e990d..4c4d696 100644 --- c/doc/emacs/display.texi +++ i/doc/emacs/display.texi @@ -285,13 +285,17 @@ Auto Scrolling @code{scroll-up-aggressively} / @code{scroll-down-aggressively}. @vindex scroll-margin +@vindex maximum-scroll-margin The variable @code{scroll-margin} restricts how close point can come to the top or bottom of a window (even if aggressive scrolling specifies a fraction @var{f} that is larger than the window portion between the top and the bottom margins). Its value is a number of screen lines; if point comes within that many lines of the top or bottom of the window, Emacs performs automatic scrolling. By default, -@code{scroll-margin} is 0. +@code{scroll-margin} is 0. The effective margin size is limited to a +quarter of the window height by default, but this limit can be +increased up to half (or decreased down to zero) by customizing +@code{maximum-scroll-margin}. @node Horizontal Scrolling @section Horizontal Scrolling diff --git c/doc/lispref/windows.texi i/doc/lispref/windows.texi index 6f3de0c..affa28c 100644 --- c/doc/lispref/windows.texi +++ i/doc/lispref/windows.texi @@ -3924,6 +3924,21 @@ Textual Scrolling out of the margin, closer to the center of the window. @end defopt +@defopt maximum-scroll-margin +This variable limits the effective value of @code{scroll-margin} to a +fraction of the current window line height. For example, if the +current window has 20 lines and @code{maximum-scroll-margin} is 0.1, +then the scroll margins will never be larger than 2 lines, no matter +how big @code{scroll-margin} is. + +@code{maximum-scroll-margin} itself has a maximum value of 0.5, which +allows setting margins large to keep the cursor at the middle line of +the window (or two middle lines if the window has an even number of +lines). If it's set to a larger value (or any value other than a +float between 0.0 and 0.5) then the default value of 0.25 will be used +instead. +@end defopt + @defopt scroll-conservatively This variable controls how scrolling is done automatically when point moves off the screen (or into the scroll margin). If the value is a