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

Compatible issue with linum-mode in Emacs 26.1 #156

Open
lihebi opened this Issue Jun 2, 2018 · 10 comments

Comments

Projects
None yet
8 participants
@lihebi
Copy link

commented Jun 2, 2018

After upgrading to Emacs 26.1, git-gutter seems to stop working with linum-mode. Specifically, when both are enabled, the left margin of the window will increase for whatever keystroke pressed. Turning off either one stops this increase.

I'm not sure if this is a compatible issue. Here is my config for git-gutter

(use-package git-gutter
  :init
  (progn
    (global-git-gutter-mode t)
    (git-gutter:linum-setup))
  :bind
  (("C-x C-g" . git-gutter:toggle))
  :config
  (progn
    (custom-set-variables
     '(git-gutter:modified-sign "  ")
     '(git-gutter:added-sign "++")
     '(git-gutter:deleted-sign "--"))
    (set-face-background 'git-gutter:modified "purple")
    (set-face-foreground 'git-gutter:added "green")
    (set-face-foreground 'git-gutter:deleted "red")))

@lihebi lihebi changed the title Left margin increase with any keystroke (after upgrading Emacs 26.1) Left margin increases with any keystroke (after upgrading Emacs 26.1) Jun 2, 2018

@lihebi lihebi changed the title Left margin increases with any keystroke (after upgrading Emacs 26.1) Compatible issue with linum-mode in Emacs 26.1 Jun 2, 2018

@lihebi

This comment has been minimized.

Copy link
Author

commented Jun 2, 2018

Emacs 26.1 has brought linum-mode obsolete, and suggests display-line-numbers-mode instead. That might be the reason for the issue.

@michaelpjohnson

This comment has been minimized.

Copy link

commented Jun 3, 2018

I can confirm that this is a linum-mode issue. I changed my init.el to:

FROM:

(global-linum-mode t)
(setq linum-format "%4d \u2502 ")

TO:

(global-display-line-numbers-mode t)
(setq display-line-numbers "%4d \u2502 ")

And the issue is gone.

@lihebi

This comment has been minimized.

Copy link
Author

commented Jun 3, 2018

But git-gutter doesn't work with display-line-numbers-mode yet, does it? I.e. there is no mark besides line numbers.

@arichiardi

This comment has been minimized.

Copy link

commented Jun 3, 2018

Can confirm the issue, and my solution was to disable linum-mode completely and use display-line-numbers-mode only when really necessary. Git-gutter is what I care the most 😉

@michaelpjohnson

This comment has been minimized.

Copy link

commented Jun 3, 2018

@lihebi I can see the marks in my gutter using the above settings. Here is my full setup:

(global-display-line-numbers-mode t)
(setq display-line-numbers "%4d \u2502 ")

...

(global-git-gutter-mode +1)
(global-set-key (kbd "C-x C-g") 'git-gutter)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(git-gutter:added-sign "☀")
 '(git-gutter:deleted-sign "☂")
 '(git-gutter:modified-sign "☁")
 '(git-gutter:update-interval 2)
 '(git-gutter:visual-line t)
 '(package-selected-packages
   (quote
    (guru-mode use-package company-anaconda anaconda-mode material-theme haskell-mode yaml-mode company-go go-projectile undo-tree git-gutter all-the-icons multiple-cursors company golint pallet atom-dark-theme solaire-mode solarized-theme smooth-scroll py-autopep8 neotree markdown-mode magit-gitflow hl-todo go-guru go-errcheck go-eldoc go-autocomplete flycheck elpy ein doom-themes doom dockerfile-mode docker buffer-move better-defaults))))
(add-to-list 'git-gutter:update-hooks 'focus-in-hook)
(add-to-list 'git-gutter:update-commands 'other-window)
@redguardtoo

This comment has been minimized.

Copy link
Contributor

commented Jun 7, 2018

Just my five cents.

  • run (global-git-gutter-mode t) AFTER (global-display-line-numbers-mode t)
  • Don't run (git-gutter:linum-setup)
@josephgrossberg

This comment has been minimized.

Copy link

commented Jul 12, 2018

Is this a duplicate of #143 ?

I believe the describe the same bug/incompatibility.

BlueMonday added a commit to BlueMonday/dotfiles that referenced this issue Jul 24, 2018

Fix infinitely increasing left margin in Emacs
linum-mode is now obsolete which ended caused issue with the git gutter
package.

See: syohex/emacs-git-gutter#156

BlueMonday added a commit to BlueMonday/dotfiles that referenced this issue Jul 24, 2018

Fix infinitely increasing left margin in Emacs
linum-mode is now obsolete which seems to result in issues with the git
gutter package.

See: syohex/emacs-git-gutter#156
@seagle0128

This comment has been minimized.

Copy link

commented Aug 12, 2018

This project looks dead...

@osxi

This comment has been minimized.

Copy link

commented Aug 13, 2018

Swapping global-linum-mode out for global-display-line-numbers-mode fixed this for me on Emacs 26.1. I just so happen to be turning on global-git-gutter-mode after globa-display-line-numbers-mode in my init.el like @redguardtoo mentioned and everything works great.

@sten0

This comment has been minimized.

Copy link

commented Feb 3, 2019

I'm investigating packaging git-gutter and git-gutter-fringe for Debian 10 (buster), which ships with Emacs 26.1. One week left before the freeze! It would be really nice if @redguardtoo's recommendations from #156 (comment) were added to README.md, because this method is confirmed to work :-) Worst case scenario I can cherry pick the commit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.