domtronn / spaceline-all-the-icons.el

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

Git Ahead Segment - Error when no upstream set for git repo #24

Closed mattiasb closed 7 years ago

mattiasb commented 7 years ago

Hi!

When I open a file in a git repo without any upstream set I get this error:

Error during redisplay: (eval (spaceline-ml-all-the-icons)) signaled (error "Running git --no-pager log --no-color --graph --decorate --date=short --... --abbrev-commit @{upstream}..HEAD ....FAILED (status 128)") [5 times]

Running the git command in a terminal yields this response:

$ git --no-pager log --no-color --graph --decorate --date=short --... --abbrev-commit @{upstream}..HEAD
fatal: no upstream configured for branch 'my_branch'
domtronn commented 7 years ago

Hey @mattiasb, can you just confirm that this is a problem with the git-ahead section?

If you're not sure, you can do this by running spaceline-all-the-icons--debug-segments inside a buffer where the mode line is error-ing and it'll tell you which segments are throwing an error 🙂

mattiasb commented 7 years ago

@domtronn It seems to be there, indeed:

Output:

Debugger entered--Lisp error: (error #("ï„´ Errors found in Spaceline Segments: [git-ahead]" 0 1 (face (:family "FontAwesome" :height 1.2) display (raise -0.24) font-lock-ignore t)))
  signal(error (#("ï„´ Errors found in Spaceline Segments: [git-ahead]" 0 1 (face (:family "FontAwesome" :height 1.2) display (raise -0.24) font-lock-ignore t))))
  error("%s Errors found in Spaceline Segments: [%s]" #("ï„´" 0 1 (font-lock-ignore t display (raise -0.24) face (:family "FontAwesome" :height 1.2))) "git-ahead")
  (if (not errors) (message "%s Spaceline is working fine!" (all-the-icons-wicon "stars")) (if pfx (progn (mapc (quote spaceline-all-the-icons--turn-off) errors))) (error "%s Errors found in Spaceline Segments: [%s]" (all-the-icons-faicon "fire-extinguisher") (mapconcat (quote identity) errors ", ")))
  (let* ((active-segments (spaceline-all-the-icons--get-active-segments)) (errors (cl-remove-if-not (function (lambda (segment) (mapc (quote spaceline-all-the-icons--turn-off) active-segments) (spaceline-all-the-icons--turn-on segment) (string= "" (format-mode-line spaceline-all-the-icons-theme)))) active-segments))) (mapc (quote spaceline-all-the-icons--turn-on) active-segments) (if (not errors) (message "%s Spaceline is working fine!" (all-the-icons-wicon "stars")) (if pfx (progn (mapc (quote spaceline-all-the-icons--turn-off) errors))) (error "%s Errors found in Spaceline Segments: [%s]" (all-the-icons-faicon "fire-extinguisher") (mapconcat (quote identity) errors ", "))))
  spaceline-all-the-icons--debug-segments()
  eval((spaceline-all-the-icons--debug-segments) nil)
  eval-expression((spaceline-all-the-icons--debug-segments) nil)
  funcall-interactively(eval-expression (spaceline-all-the-icons--debug-segments) nil)
  #<subr call-interactively>(eval-expression nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> eval-expression nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (eval-expression nil nil))
  call-interactively(eval-expression nil nil)
  #[1025 "\306\211?\205
domtronn commented 7 years ago

I'm looking into this, but I'm not really happy with this segment... It noticeably slows down even my set up, and that's because it's running git commands like, allll of the time... :/

I can push a quick fix if you'd like? But I'm going to try and refactor this so if you're happy to wait, I'd recommend disabling this segment for now.

domtronn commented 7 years ago

I have an idea of how to make this a bit more performant, but it means you'll only get the updated number of commits ahead after your next save following a commit..

mattiasb commented 7 years ago

That makes sense.

Den 25 apr. 2017 9:20 fm skrev "Dom Charlesworth" <notifications@github.com

:

I have an idea of how to make this a bit more performant, but it means you'll only get the updated number of commits ahead after your next save following a commit..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/domtronn/spaceline-all-the-icons.el/issues/24#issuecomment-296938718, or mute the thread https://github.com/notifications/unsubscribe-auth/ABR3gcE3nAA6WbP9qZHHuWtiAoXmsaHZks5rzZ6ngaJpZM4NGJNJ .

domtronn commented 7 years ago

Right, there should be a fix there now, and it should be a lot more performant!

If you could try this out once it's built to MELPA, that would be great :)

You'll have to run (spaceline-all-the-icons--setup-git-ahead) in your setup now

mattiasb commented 7 years ago

Yep it works fine now, thanks! :)