From 4c8910e39d0ffc35dedb08a2b5472c12b8e0ecfa Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Wed, 26 Dec 2018 15:35:07 +0800 Subject: [PATCH] Fix: unable to get notifications asynchronously. --- doom-modeline.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doom-modeline.el b/doom-modeline.el index 03bc5b4..b3ff59b 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -1564,12 +1564,16 @@ mouse-3: Describe current input method") (defun doom-modeline-github-fetch-notifications () "Fetch github notifications." (if (and doom-modeline-github - (fboundp 'async-start) - (fboundp 'ghub-get)) + (fboundp 'async-start)) (async-start (lambda () - (ignore-errors - (ghub-get "/notifications" nil :query '((notifications . "true"))))) + (package-initialize) + (require 'ghub nil t) + (when (fboundp 'ghub-get) + (ghub-get "/notifications" + nil + :query '((notifications . "true")) + :noerror t))) (lambda (result) (setq doom-modeline--github-notifications-number (length result))))))