Geoffrey Lessel is an Elisp n00b. Really a n00b. He’s not sure what the car
and cdr
of a list are and he doesn’t understand backquotes
. But he’s not afraid to dig in and discover things as he goes along. He proves that by taking on a project that many would consider too difficult for a beginner: he wants to retrieve a list of open pull requests from Github so that he can select one and display it in his browser.
There are a lot of moving parts in that exercise. For example, you’ve got to connect to Github, deal with authentication, parse the returned JSON, extract the relevant information as a list, pass the list to a chooser function, and call your browser of choice with the URL for the chosen PR. All that might be a challenge for even an intermediate Elisper but Lessel shows how to approach the problem even if you’re not sure where you’re going at every step.
He does that by leveraging Emacs’ discoverability and exploratory programming. First he writes some code just to retrieve a bit of JSON from a site that doesn’t require authentication. He experiments with ways of parsing the JSON into a more convenient form and then extracting one of the values. Next he uses some of the auth-*
functions to login into Github and retrieve the data he needs. Finally, he extracts a list of the PRs from the JSON that Github returned. He leaves the building of the choice list and calling of the browser to his next video.
This is a long video—almost an hour and 23 minutes—and a lot of time is spent just figuring things out. More experienced Elispers might get exasperated as he feels his way along but everyone can learn a lot from how he does figure those things out. You might even learn something new. For example, I learned about seq-doseq
, a very useful generalization of dolist
to arbitrary sequences. The next time you hear someone whine that Elisp is too hard to learn and use, point them to this video.