GNU bug report logs - #5718
scroll-margin in buffer with small line count.

Previous Next

Package: emacs;

Reported by: Oleksandr Gavenko <gavenkoa <at> gmail.com>

Date: Sun, 14 Mar 2010 17:28:02 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #16 received at 5718 <at> debbugs.gnu.org (full text, mbox):

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Cc: Andrew Hyatt <ahyatt <at> gmail.com>, 5718 <at> debbugs.gnu.org
Subject: Re: bug#5718: scroll-margin in buffer with small line count.
Date: Thu, 11 Aug 2016 16:05:57 +0300
On 2016-08-11, npostavs <at> 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/




This bug report was last modified 8 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.