From f2f7aaf3922eae44e5fe1cf282cae7e95bff5085 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Tue, 8 Jan 2019 02:29:46 +0800 Subject: [PATCH] Fix hang issue in fetching github notifications. If there is no github access token, ghub requires to create and save from minibuffer, thus will cause hang in async process. Just ignore it if no token. --- doom-modeline.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doom-modeline.el b/doom-modeline.el index 82775f7..73d0093 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -1853,10 +1853,14 @@ mouse-3: Describe current input method") (when (fboundp 'ghub-get) (with-timeout (10) (ignore-errors - (ghub-get "/notifications" - nil - :query '((notifications . "true")) - :noerror t))))) + (if (ghub--token ghub-default-host + (ghub--username ghub-default-host) + 'ghub + t) + (ghub-get "/notifications" + nil + :query '((notifications . "true")) + :noerror t)))))) (lambda (result) (setq doom-modeline--github-notifications-number (length result))))))