From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Oleksandr Gavenko Newsgroups: gmane.emacs.bugs Subject: bug#5718: scroll-margin in buffer with small line count. Date: Thu, 11 Aug 2016 16:05:57 +0300 Organization: Oleksandr Gavenko , http://defun.work/ Message-ID: <874m6rv4ju.fsf@gavenkoa.example.com> References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1470920845 18188 195.159.176.226 (11 Aug 2016 13:07:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 11 Aug 2016 13:07:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cc: Andrew Hyatt , 5718@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 11 15:07:17 2016 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 1bXphc-0004Rp-IN for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Aug 2016 15:07:16 +0200 Original-Received: from localhost ([::1]:48530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXphZ-0004sn-C2 for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Aug 2016 09:07:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXphR-0004rt-PV for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2016 09:07:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXphO-0005v8-Hz for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2016 09:07:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXphO-0005ur-E4 for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2016 09:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bXphO-0006GQ-1b for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2016 09:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Oleksandr Gavenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Aug 2016 13:07:02 +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: Original-Received: via spool by 5718-submit@debbugs.gnu.org id=B5718.147092076623992 (code B ref 5718); Thu, 11 Aug 2016 13:07:02 +0000 Original-Received: (at 5718) by debbugs.gnu.org; 11 Aug 2016 13:06:06 +0000 Original-Received: from localhost ([127.0.0.1]:53170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXpgU-0006Es-Fp for submit@debbugs.gnu.org; Thu, 11 Aug 2016 09:06:06 -0400 Original-Received: from mail-wm0-f52.google.com ([74.125.82.52]:36215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXpgS-0006EN-PH for 5718@debbugs.gnu.org; Thu, 11 Aug 2016 09:06:05 -0400 Original-Received: by mail-wm0-f52.google.com with SMTP id q128so28924769wma.1 for <5718@debbugs.gnu.org>; Thu, 11 Aug 2016 06:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version; bh=D2/aPv5PiOl7OmwWl4bUAZfABvOtIKlwAqeBcDf9eY4=; b=OZNLOnhEy17nFgTz3u0Env+DmhFtzInx5RSKObapqEod98h1XyZBk1VM9C0QjTAFOV f5aTxpDS9b4iDfUZm+FlBx7YH/f0F2gQLA3RCVYpvI8F8IM62JNY5CtZtFY7zr5f1OUO N0ilsNHglnKTeJTx8EKSNCXAEFo6YcoTODvP2FfmuywyS4sLawewRKISWq5kl2LQQJX0 KbpPP0zKCIKBwIjumh7Qv0/lrg0lGpFB1LBOvoqHZut6fMrCToZktrOiHATs7f3C/RzS ttaKFC1I6Xj1A6f4vhDCa1wPhZnbnuA6/ZulAqlzoqybGxfgzDXdlGjsYziHCnQ1Fr5g 68ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version; bh=D2/aPv5PiOl7OmwWl4bUAZfABvOtIKlwAqeBcDf9eY4=; b=fROogGKfuC09wlmSOYmq3bmhOWSFyoVZdjuuJddcG9UcSLCpzz86cPL/A/+YSziFQk IZtu8i+4Fdl41mmnMWC+lNEryjMQGI4YMuR3Ao4wbgyvBcB0zAs/vyFWNhpM5GeJFxM/ 0zjWqDBtFESLFKjgZoO+0F4IgeTw/riqCWmQEfgp3wa91Q4WOuC3k71qfqxVmrWiqIgX ygJkSDVV6ICRwm+uxadyI6lo4BNi0gQQJIrq4f2oa3e7QT1LZTr6s6lPObNvYHvo3wM5 4PwfVi7GaB3aIJIcl7CC9BNA57jjoUlFzqQjMcNUo+9Lnr4/pLWAgviSJhlQnyChzoEn ENbQ== X-Gm-Message-State: AEkoouseyMgGu3N/2ETyVTDEIQjEnNTEazKRNL6f2qkVUpu22ssbALBYQjlaoEfrPXLmHA== X-Received: by 10.25.21.197 with SMTP id 66mr1469111lfv.99.1470920759040; Thu, 11 Aug 2016 06:05:59 -0700 (PDT) Original-Received: from desktop ([46.185.21.165]) by smtp.gmail.com with ESMTPSA id 35sm564457ljb.10.2016.08.11.06.05.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Aug 2016 06:05:58 -0700 (PDT) In-Reply-To: <87mvkjy0l5.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Thu, 11 Aug 2016 08:03:18 -0400") 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:122072 Archived-At: On 2016-08-11, npostavs@users.sourceforge.net wrote: > I think the complaint is that the `scroll-margin' effective value is > capped at a 1/4 of the window height, as seen in this > window_scroll_pixel_based (window.c): > > this_scroll_margin = max (0, scroll_margin); > this_scroll_margin > = min (this_scroll_margin, window_total_lines / 4); > > Whereas, it seems more logical to cap it at half window height. > Yes, that was what I meant! Setting this_scroll_margin to 'window_total_lines / 2' keeps current line centered for short buffers. I think it is most desired behavior because it takes more surrounding context in small buffer. Many recipes suggest to set 'scroll-margin' to very large number to keep current line always centered. ================================================================ On reporting day I removed: (setq-default scroll-margin 4) from ~/.emacs because in "M-x calendar" UP/DOWN navigation become broken. Even in Emacs 24.5.1 setting (setq scroll-margin 4) in Calendar buffer hide month names on UP/DOWN moves. Since that time I selectively set scroll-margin: (make-variable-buffer-local 'scroll-margin) (defun my-set-scroll-margin () (setq scroll-margin 4)) (mapc (lambda (hook) (add-hook hook #'my-set-scroll-margin)) (delete-dups (append my-text-mode-hook-list my-devel-mode-hook-list)) ) to avoid setting 'scroll-margin' in Calendar. In order just to use: (setq-default scroll-margin 4) Emacs should not take in a count 'scroll-margin' when all lines are visible. Those are all my discoveries about 'scroll-margin' that makes Emacs usage experience less delightful. -- http://defun.work/