[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5718: scroll-margin in buffer with small line count.
From: |
Oleksandr Gavenko |
Subject: |
bug#5718: scroll-margin in buffer with small line count. |
Date: |
Thu, 11 Aug 2016 16:05:57 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
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/