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

Ctrl + n stops showing cursor (when kept pressed) #5456

Closed
jramapuram opened this issue Mar 11, 2016 · 25 comments
Closed

Ctrl + n stops showing cursor (when kept pressed) #5456

jramapuram opened this issue Mar 11, 2016 · 25 comments

Comments

@jramapuram
Copy link

Description

Ctrl + n stops scrolling abruptly until release when it warps to a new location.
Issue does not happen with emacs native
Issue does not happen with Ctrl + p
Installed fresh spacemacs and see the issue.

Just in case fyi I installed emacs with brew using:
brew install emacs --with-cocoa --with-gnutls --with-rsvg --with-imagemagick --srgb

Reproduction guide

  • Have multiple page document.
  • Press Ctrl + n

Observed behaviour:
See here: http://sendvid.com/zs96hs4j

Expected behaviour:
Smooth scrolling & no warping.

System Info

  • OS: darwin
  • Emacs: 24.5.1
  • Spacemacs: 0.105.14
  • Spacemacs branch: master (rev. a298a5a)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: emacs
  • Completion: helm
  • Layers:
(emacs-lisp)

Edit: add info about Ctrl+P

@jramapuram
Copy link
Author

fyi this is not an issue with commit 0562f05

@TheBB
Copy link
Collaborator

TheBB commented Mar 16, 2016

Can you bisect?

@jramapuram
Copy link
Author

There is quite a bit going on ... I tried to change swap out the themes el file as well as the python one (where I see the issue the most) and haven't found it yet. I will try to go rev by rev if I have some time. Surprised no one else is having this issue. It's pretty unbearable.

@StreakyCobra
Copy link
Contributor

I will try to go rev by rev

Don't do this. Use git-bisect instead: http://www.metaltoad.com/blog/beginners-guide-git-bisect-process-elimination

Roughly:

  1. Start the bisect: git bisect start
  2. Find a non-working commit and annotate it: git bisect bad COMMIT_HASH
  3. Find a working commit and annotate it: git bisect good COMMIT_HASH
  4. Loop until git bisect has found the problematic commit:
    1. The bisect will checkout a new commit to try
    2. Try to reproduce your bug
    3. If the bug appears: git bisect bad, if it doesn't git bisect good
    4. Repeat

It will require you approximately 8 try (2^7 < 147 < 2^8).

@jramapuram
Copy link
Author

Thank you, this is super useful in general. Will give it a shot and get back.

@jramapuram
Copy link
Author

Here is the result:

(.venv)➜  .emacs.d git:(103bd2b) ✗ git bisect good
e33a39c7356119cc7201ab16cef7478fdc5b8afa is the first bad commit
commit e33a39c7356119cc7201ab16cef7478fdc5b8afa
Author: syl20bnr <sylvain.benner@gmail.com>
Date:   Wed Mar 2 09:13:09 2016 -0500

    Update, simplify and add smooth scrolling toggle on `SPC t v`

:040000 040000 c42dc16861f27dcf020015865a2438891619dd3e e022ecbce700fa0f3578e567b51a32cee74c88ba M  doc
:040000 040000 87c3425eff3f42acf7ce4f218221d8daf7d2ede4 3164366c9b70d25dbacb96bdb9caf95969283d86 M  layers

@StreakyCobra
Copy link
Contributor

Link to the problematic commit: e33a39c

Seems to be related to smooth scrolling. Can you try to disable it it by adding it to the dotspacemacs-excluded-package list and see if you can still reproduce the bug?

@d12frosted
Copy link
Collaborator

Disabling smooth-scroll fixes bug :) But you don't have smooth-scroll anymore :)

@StreakyCobra
Copy link
Contributor

@d12frosted Can you try reproducing this on stock emacs (without Spacemacs, SPC q D may help) so we see if this is a Spacemacs bug, an upstream bug, or a bug coming from packages combination.

@d12frosted
Copy link
Collaborator

Sure, I'll do it. But I think I'll do it only tomorrow :)

@jramapuram
Copy link
Author

Hmm I disabled smooth-scroll but still seem to have the issue:

   dotspacemacs-excluded-packages
   '(
     smooth-scroll
     )

I also tried to disable smooth-scrolling-mode but still see the issue

@StreakyCobra
Copy link
Contributor

smooth-scroll

smooth-scrolling :-)

@jramapuram
Copy link
Author

Slight update: disabling smooth-scrolling on commit 0562f05 (ie the original working one) does not resolve the issue (the scrolling only remains linear with this package enabled). Tested this with a multi-page python file.

@jramapuram
Copy link
Author

@d12frosted : Any update here?

@jramapuram
Copy link
Author

@StreakyCobra : Just tried on base emacs install and it works perfectly.

(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.org/packages/")))
(package-initialize)

(defun ensure-package-installed (&rest packages)
  "Assure every package is installed, ask for installation if it’s not.
Return a list of installed packages or nil for every skipped package."
  (mapcar
   (lambda (package)
     ;; (package-installed-p 'evil)
     (if (package-installed-p package)
         nil
       (if (y-or-n-p (format "Package %s is missing. Install it? " package))
           (package-install package)
         package)))
   packages))

;; make sure to have downloaded archive description.
;; Or use package-archive-contents as suggested by Nicolas Dudebout
(or (file-exists-p package-user-dir)
    (package-refresh-contents))

(setq jr-packages  '(smooth-scrolling))

(dolist (pkg jr-packages)
  (ensure-package-installed pkg))

(package-initialize)
(require 'smooth-scrolling)
(smooth-scrolling-mode 1)

@StreakyCobra
Copy link
Contributor

It's probably an interaction problem between several packages then. The goal is to find which ones 😃

@jramapuram
Copy link
Author

Issue resolved by replacing this [in .emacs.d/layers/+distribution/spacemacs/packages.el]:

(defun spacemacs/init-smooth-scrolling ()
  (use-package smooth-scrolling
    :init
    (progn
      (setq smooth-scroll-margin 5)
      (spacemacs|add-toggle smooth-scrolling
        :status smooth-scrolling-mode
        :on (progn
              (smooth-scrolling-mode)
              (enable-smooth-scroll-for-function previous-line)
              (enable-smooth-scroll-for-function next-line)
              (enable-smooth-scroll-for-function isearch-repeat))
        :off (progn
               (smooth-scrolling-mode -1)
               (disable-smooth-scroll-for-function previous-line)
               (disable-smooth-scroll-for-function next-line)
               (disable-smooth-scroll-for-function isearch-repeat))
        :documentation "Smooth scrolling."
        :evil-leader "tv")
      (when dotspacemacs-smooth-scrolling
        (spacemacs/toggle-smooth-scrolling-on))
      ;; add hooks here only for emacs built-in packages that are not owned
      ;; by a layer.
      (defun spacemacs//unset-scroll-margin ()
        "Set scroll-margin to zero."
        (setq-local scroll-margin 0))
      (spacemacs/add-to-hooks 'spacemacs//unset-scroll-margin
                              '(messages-buffer-mode-hook)))))

with:

(defun spacemacs/init-smooth-scrolling ()
  (defun spacemacs//unset-scroll-margin ()
    "Set scroll-margin to zero."
    (setq-local scroll-margin 0))

  (use-package smooth-scrolling
    :if dotspacemacs-smooth-scrolling
    :init (setq smooth-scroll-margin 5
                scroll-conservatively 101
                scroll-preserve-screen-position t
                auto-window-vscroll nil)
    :config
    (progn
      (setq scroll-margin 5)
      ;; add hooks here only for emacs built-in packages
      (spacemacs/add-to-hooks 'spacemacs//unset-scroll-margin
                              '(messages-buffer-mode-hook
                                comint-mode-hook
                                term-mode-hook))))

  (unless dotspacemacs-smooth-scrolling
    ;; deactivate smooth-scrolling advices
    (ad-disable-advice 'previous-line 'after 'smooth-scroll-down)
    (ad-activate 'previous-line)
    (ad-disable-advice 'next-line 'after 'smooth-scroll-up)
    (ad-activate 'next-line)
    (ad-disable-advice 'isearch-repeat 'after 'isearch-smooth-scroll)
    (ad-activate 'isearch-repeat)))

@StreakyCobra
Copy link
Contributor

@jramapuram If you think this may be useful for other users, you can do a PR to have it reviewed and eventually merged 😃

@jramapuram
Copy link
Author

@StreakyCobra : Should be fine, however all I really did above is replace the new changes with the old ones. Not sure how this affects other packages which might require spacemacs|add-toggle smooth-scrolling as a dep.

@nelson-liu
Copy link

@jramapuram your solution works fantastically, thanks!

@cydparser
Copy link

cydparser commented May 6, 2016

Setting scroll-conservatively to something other than the default value of 0 fixes the issue for me. Try adding (setq scroll-conservatively 101) to dotspacemacs/user-config.

Edit: setting scroll-conservatively stopped working...

@quicknir
Copy link
Contributor

quicknir commented Jun 3, 2016

This is still an issue. Any chance this can be merged? I'm not too eager to dig into the internals of the layers. I am trying to convince an emacs guy to try spacemacs, as it so happened he held down the down arrow key in emacs mode and hit on this issue in the first 30 seconds of using it, making it hard to convince him :-) (for me it's less of an issue because in evil, this interestingly only shows up in insert mode, not normal mode)

@TheBB
Copy link
Collaborator

TheBB commented Aug 29, 2016

We fixed a number of smooth-scrolling problems in develop. Can someone confirm if this is fixed?

@jramapuram
Copy link
Author

@TheBB : Will give it a shot tomorrow! Thanks

@jramapuram
Copy link
Author

Fixed in 0.200 running on emacs 25.1.1

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