Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smooth-scroll-margin vs scroll-margin #6097

Closed
agriffis opened this issue May 20, 2016 · 12 comments
Closed

smooth-scroll-margin vs scroll-margin #6097

agriffis opened this issue May 20, 2016 · 12 comments

Comments

@agriffis
Copy link
Contributor

agriffis commented May 20, 2016

(I tried to report this within Spacemacs but it seems like [SPC h I] doesn't do anything from terminal emacs-client.)

The default setting for smooth-scroll-margin is 5, but the default for scroll-margin is 0. This means that when one presses C-f to scroll forward by a page, the cursor is at the very top of the window according to scroll-margin. Then pressing any key will adjust the scrolling for smooth-scroll-margin, which is a jarring experience every time.

Furthermore, I tried to work around this by setting smooth-scroll-margin 0 but that seems to disable smooth scrolling entirely, causing emacs to revert to the recentering behavior.

System Info

  • OS: gnu/linux
  • Emacs: 24.5.1
  • Spacemacs: 0.105.20
  • Spacemacs branch: master (rev. 9c7250a)
  • Graphic display: nil
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(auto-completion better-defaults git github
                 (clojure :variables clojure-enable-fancify-symbols t)
                 emacs-lisp html markdown org python django
                 (syntax-checking :variables syntax-checking-enable-tooltips nil)
                 themes-megapack)
@agriffis
Copy link
Contributor Author

This is my current workaround:

  (setq scroll-margin 1)
  (setq smooth-scroll-margin 1)

which avoids the jarring effect, and gets as close to 0 as allows smooth scrolling to still take effect.

@NJBS
Copy link
Contributor

NJBS commented May 20, 2016

I'd also like to add that this behavior occurs with evil-scroll-line-down (C-e) and evil-scroll-line-up (C-y). scroll-margin stopped being set in this commit in favor of smooth-scroll-margin, but it seems that not all scrolling methods respect smooth-scroll-margin.

@sooheon
Copy link

sooheon commented May 20, 2016

I've found I don't need to touch smooth-scroll-margin.

  (setq scroll-conservatively 101
        scroll-margin 3
        scroll-preserve-screen-position 't)

This will replicate evil scrolloff behavior pretty well in my experience.

@StreakyCobra
Copy link
Contributor

(I tried to report this within Spacemacs but it seems like [SPC h I] doesn't do anything from terminal emacs-client.)

#5902 and #5912

@sooheon
Copy link

sooheon commented May 20, 2016

@agriffis try this:

   with dotspacemacs-smooth-scrolling nil

  (setq scroll-conservatively 101
        scroll-margin 0
        scroll-preserve-screen-position 't)

@agriffis
Copy link
Contributor Author

@sooheon that works for me, thanks

@syl20bnr
Copy link
Owner

So we don't need smooth-scrolling ?

@sooheon
Copy link

sooheon commented May 20, 2016

In my recent experience, no. Those three default variables will do it for me, and often better: for example, at least for me, the way it behaves after some screenwise movements like C-f or G is better. W/ smooth-scroll, the margin is sometimes not respected until you make a linewise movement.

@syl20bnr
Copy link
Owner

I tried without smooth-scrolling and the result was not satisfying, the point is jumping depending on the responsiveness which is not the case with smooth-scrolling.

I investigated to make smooth-scrolling to work with smooth-scrolling-margin to 0, turns out it is not trivial. The number of lines computed is not very reliable (especially for the bottom of the window) and word wrap is not easy to handle. smooth-scrolling tries to keep the point on screen at all costs, if it fails then the point jumps.

syl20bnr added a commit that referenced this issue May 21, 2016
My tests show that scroll-conservatively does the job, need your
feedback on this.

See #6097
@syl20bnr
Copy link
Owner

Actually I retested and found that scroll-conservatively does the job, like @sooheon.
I pushed #6097 to let people test in their config.

@TheBB
Copy link
Collaborator

TheBB commented May 30, 2016

Since nobody complained in nine days I'm marking this as fixed.

@d12frosted
Copy link
Collaborator

Fixed with released of Spacemacs v0.200. Let us know if you still have any problems with this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants