update: WIP here: https://gitlab.com/emacs-stuff/magit-notify working but lacks configuration.

I'd like more visible magit notifications: often I want to push some commits but there is an error (a protected branch, I must pull upstream changes,…) and:

  • the confirmation or error message is not very visible in the echo area,
  • it can appear not immediatly, depending on the project and on the network, in which case I may have exited the magit buffer,
  • I'd like immediate visible feedback (green/red),
  • I'd like to see more quiclkly what the cause is (currently we must go to magit's log buffer)

so I don't see the error easily and this can lead to a situation where I think mistakenly that I have pushed my changes.

Can we already do something about that ?

desktop notifications (built-in) might be nice (other ideas?) (however I don't see them when Emacs is full-screen) and its api is straightforward:

(require 'notifications)
(notifications-notify :title "push succeeded" :body "push to gitlab.com/name/project, branch foo etc")

so, speaking about implementation: how do we get the return code, what would be the function to advise ? magit-process-finish seems of interest because it seems to check the return code and the explanations. What can we do with that, any implementation tips ?

1 Answer 1


You should be able to do this by wrapping magit-process-finish. It returns the exit code and stores the error message in the variable magit-this-error.

  • wrapping with defadvice ? I'm not familiar with it yet but I'll have a look, thanks.
    – Ehvince
    Commented Jun 6, 2017 at 21:37
  • I'm experimenting here: gitlab.com/emacs-stuff/magit-notify it lacks some features (filtering of events) and the magit-this-error isn't very explicit ("git failed" instead of "Cannot pull with rebase: You have unstaged changes") but it's working and it was easy (one defadvice, less than 10 lines).
    – Ehvince
    Commented Jun 14, 2017 at 9:52
  • Usually you should get the last error message that Magit was able to identify as such. See magit-process-finish's use of magit-process-error-message-re.
    – tarsius
    Commented Jun 14, 2017 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.