A few weeks ago I noticed a new package on Melpa called github-notifier by
Chunyang, which displays a count of your Github notifications on the mode-line.
Instead of just installing the package like a normal person, I had an urge to
try and see how hard it would be to write from scratch. Paradox already has a
function for interacting with the Github API, so it’s just a matter of putting
it to work.
The first thing you need to do is visit your Github tokens page, and edit the
Paradox token to allow access to your notifications.
Next, define a command to visit your notifications, and a function to display a
button in the mode-line.
For convenience, I’ve also added visit-notifications to my launcher-map under
n.
Next, write a function to query the Github API and pass the vector of
results to count-for-mode-line.
Finally, just set the timer to some convenient interval. I run it at every 30
seconds of idle time.
And that’s all! Roughly 30 lines of code and you have a convenient notification
system. Whenever you see that GH-2 show up at the corner of your mode-line,
just click on it (or type C-x l n). That will remove the button and take you
to Github. On Github you can navigate with j, k, and RET, and “mark as
read” with m.
Using Paradox for Github notifications
30 Nov 2015, by Artur Malabarba.A few weeks ago I noticed a new package on Melpa called github-notifier by Chunyang, which displays a count of your Github notifications on the mode-line. Instead of just installing the package like a normal person, I had an urge to try and see how hard it would be to write from scratch. Paradox already has a function for interacting with the Github API, so it’s just a matter of putting it to work.
The first thing you need to do is visit your Github tokens page, and edit the Paradox token to allow access to your notifications.
Next, define a command to visit your notifications, and a function to display a button in the mode-line.
For convenience, I’ve also added
visit-notifications
to my launcher-map under n.Next, write a function to query the Github API and pass the vector of results to
count-for-mode-line
.Finally, just set the timer to some convenient interval. I run it at every 30 seconds of idle time.
And that’s all! Roughly 30 lines of code and you have a convenient notification system. Whenever you see that
GH-2
show up at the corner of your mode-line, just click on it (or type C-x l n). That will remove the button and take you to Github. On Github you can navigate with j, k, and RET, and “mark as read” with m.Tags: paradox, github, init.el, emacs,
Marking Emacs chat buffers as read (erc, jabber, etc) »
« Update on tdd-mode with CIDER
Related Posts
It’s Magit! And you’re the magician! in github
Paradoxical Hydras in paradox
Paradox 2.0 Released: Execution hook, Interface improvements, Async Execution in paradox
Content © 2019, All rights reserved. Icons under CC3.0.