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

Confliction with git-gutter #51

Closed
toyboot4e opened this issue Jul 3, 2020 · 2 comments
Closed

Confliction with git-gutter #51

toyboot4e opened this issue Jul 3, 2020 · 2 comments

Comments

@toyboot4e
Copy link

toyboot4e commented Jul 3, 2020

Edit

Update:

In Emacs27.1 git-gutter is not conflicting with olivetti on my computer! You may not need to take care, either!

In short

Olivetti uses margins and it often conflicts with git-gutter. git-gutter-fringe works well in GUI and for terminal I made a hack (gist).

Summary

It happens if git-gutter is loaded. It may be related to #42.

When changes are saved, current window with buffer in olivetti-mode loses distraction-free looking:

olivetti_git_gutter

The left window lost distraction-free looking while it's in olivetti-mode

Steps to reproduce

  1. Start Emacs with git-gutter and olivetti-mode. Also I opened init.el.
  2. M-x olivetti-mode RET
  3. Change the buffer and save it

init.el for reproduction

Enable use-package:

(progn
    (require 'package)
    (package-initialize)
    (setq package-enable-at-startup nil)
    (setq package-archives
          '(("gnu"   . "http://elpa.gnu.org/packages/")
            ("melpa" . "http://melpa.org/packages/")
            ("org"   . "http://orgmode.org/elpa/"))))

;; Install and enable use-package
(eval-when-compile
    (unless (package-installed-p 'use-package)
        (package-refresh-contents)
        (package-install 'use-package))
    (require 'use-package))

And then the packages:

(use-package olivetti :ensure t)

(use-package git-gutter
    :ensure t
    :config (global-git-gutter-mode +1))

;; I didn't use it, but if you like
;; (use-package evil
;;     :ensure t
;;     :config (evil-mode))

Actions to solve the issue

If it can't be fixed

  • I think this is an important problem that worth noting in README.
  • I'd like to find some hack to re-enable the distractin-free looking automatically after it's lost. (If I can.. but I'm not sure since I'm not yet faimlar with Emacs)

My attampt to find the hack

I could do one of the follows to re-enable the distraction-free looking:

  1. M-: (run-hooks 'write-file-functions) RET
  2. Type ESC (or some key) to show which-key in minibuffer

For which-key, I used the following configuration:

(use-package which-key
  :ensure t
  :config
  ;; Show hints immediately
  (setq which-key-idle-delay 0.01)
  (setq which-key-idle-secondary-delay 0.01)
  (setq which-key-popup-type 'minibuffer)
  (which-key-mode))

Thank you


edit: typo and indentations

@rnkn
Copy link
Owner

rnkn commented Jul 4, 2020

The manipulation of the margins is pretty rudimentary in Emacs, so it's unlikely to ever have multiple modes that set the margins happily coexist. If you're looking for a way to indicate git changes at the side of the window I think a mode that uses the fringe will probably work better.

@toyboot4e
Copy link
Author

I tried git-gutter-fringe and it worked pretty well on GUI!

git-gutter didn't work well in terminal, but I found a hack to re-enable it automatically (gist). Thank you!

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

No branches or pull requests

2 participants