Function: doom-modeline--github-fetch-notifications

doom-modeline--github-fetch-notifications is a natively compiled function defined in doom-modeline-segments.el.

Signature

(doom-modeline--github-fetch-notifications)

Documentation

Fetch GitHub notifications.

It requires async and ghub packages.

Source Code

;; Defined in /nix/store/1lcicrdd2r4b8rkc91nnn74ymk1jl6yd-emacs-packages-deps/share/emacs/site-lisp/elpa/doom-modeline-20260928.1632/doom-modeline-segments.el
(defun doom-modeline--github-fetch-notifications ()
  "Fetch GitHub notifications.
It requires `async' and `ghub' packages."
  (when (and doom-modeline-github
             (require 'async nil t))
    (async-start
     `(lambda ()
        ,(async-inject-variables
          "\\`\\(load-path\\|auth-sources\\|doom-modeline-before-github-fetch-notification-hook\\)\\'")
        (run-hooks 'doom-modeline-before-github-fetch-notification-hook)
        (when (require 'ghub nil t)
          (with-timeout (10)
            (ignore-errors
              (when-let* ((host (alist-get 'github ghub-default-host-alist))
                                      (username (ghub--username host))
                          (token (or (ghub--token host username 'forge t)
                                     (ghub--token host username 'ghub t))))
                (ghub-get "/notifications"
                          '((notifications . t))
                          :host host
                          :username username
                          :auth token
                          :unpaginate t
                          :noerror t))))))
     (lambda (result)
       (message "")                     ; suppress message
       (setq doom-modeline--github-notification-number (length result))
       (run-hooks 'doom-modeline-after-github-fetch-notification-hook)))))