domtronn / spaceline-all-the-icons.el

A Spaceline Mode Line theme using All The Icons for Emacs
MIT License
234 stars 24 forks source link

Git status not working by default #5

Closed idoo closed 7 years ago

idoo commented 7 years ago

Debugging returns that git no errors but I can't still see that block http://take.ms/jpXFn

domtronn commented 7 years ago

What happens if you call (git-gutter:statistic) inside a file with diffs?

idoo commented 7 years ago

Added 0 lines, deleted 0 lines

But I have such changes that shows by git gutter+ http://take.ms/VZHni

idoo commented 7 years ago

Enable git-gutter-mode solve my pain πŸ‘

Probably it would be nice to add this to documentation

domtronn commented 7 years ago

Interesting, I guess it's because I've been using git-gutter-fringe which is derived from git-gutter and therefore requires git-gutter-mode to be on πŸ˜…

I'm working on a refactor to make the segment work with both git-gutter and git-gutter+, so I'd be interested if this works for you? As a plus, git-gutter+ also tells you modified buffers lines as well!

idoo commented 7 years ago

@domtronn I updated but it still doesn't works for me :(

also I found interesting case β€”Β it doesn't works with global-git-gutter but works well wit if I enable this mode for current buffer

domtronn commented 7 years ago

I've tested this a few times with a blank install of all variants of git-gutter, git-gutter+, git-gutter-fringe and git-gutter-fringe+ and it seems to work fine when their relevant modes are enabled...

It also worked when I use both global-git-gutter-mode and global-git-gutter+-mode...

I'm sorry it's not working for you though! Would you mind look printing out these variables inside a file with diffs?

git-gutter+-diffinfos
git-gutter:diffinfos
idoo commented 7 years ago

I don't have such commands, probably that's why, which version of git-gutter+ do you use?

my current is

;; Author: Syohei YOSHIDA <syohex@gmail.com> and contributors
;; URL: https://github.com/nonsequitur/git-gutter-plus
;; Package-Version: 20151204.923
;; Version: 0.4

I'm not expert, but looks like it local buffer vars, isn't it?

(make-variable-buffer-local 'git-gutter+-diffinfos)
(make-variable-buffer-local 'git-gutter+-diff-header)
domtronn commented 7 years ago

I've got the same version of git-gutter-plus, I'm installing it using a package called try so that it's fresh each time I restart emacs. Yes, you're right git-gutter+ sets the variables to be buffer local, but when you enable the mode in a buffer (either through global or hooks), it should make sure those variables are defined.

Inside your buffer with diffs, what are the values of the following variables?

git-gutter-mode
git-gutter+-mode
idoo commented 7 years ago

git-gutter-mode was disabled git-gutter+-mode was enabled

domtronn commented 7 years ago

No surprises there! That's good at least πŸ˜…

I don't get why you don't have git-gutter+-diffinfos defined though... It's there for me and should look something like this

((:type deleted :content "..." :start-line 134 :end-line 134)
 (:type added :content "..." :start-line 207 :end-line 207)
 (:type added :content "..." :start-line 276 :end-line 286))
idoo commented 7 years ago

Probably it's because I use spacemacs init configuration. Can you test it on it, please?

domtronn commented 7 years ago

I installed spacemacs, and the diffinfos variable was defined as expected, but I still had to installed git-gutter+ manually...

But I think I know what the problem is! πŸŽ‰

I fixed it in a refactor this morning, I guess it's not built up to Melpa yet... But there's a predicate on the git-stats segment (see here) which requires functions to be defined from git-gutter!

Could you have a look to see if that line looks like this in your installation? Otherwise, hopefully the new version should be on Melpa soon :)

(and active
      (fboundp 'git-gutter:statistic)
      (not (equal '(0 . 0) (git-gutter:statistic))))
idoo commented 7 years ago

I have

  :when (and active
             (fboundp 'git-gutter:statistic)
             (not (equal '(0 . 0) (git-gutter:statistic)))))

so, my fingers crossed 🀞

idoo commented 7 years ago

@domtronn I've added PR to get latest Melpa version in readme https://github.com/domtronn/spaceline-all-the-icons.el/pull/8

idoo commented 7 years ago

and it works now πŸ‘