{"id":9684,"date":"2021-05-10T12:32:46","date_gmt":"2021-05-10T16:32:46","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=9684"},"modified":"2021-05-10T12:32:46","modified_gmt":"2021-05-10T16:32:46","slug":"getting-a-list-of-open-prs-from-github","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=9684","title":{"rendered":"Getting a List of Open PRs from Github"},"content":{"rendered":"<p>Geoffrey Lessel is an Elisp n00b. <i>Really<\/i> a n00b. He\u2019s not sure what the <code>car<\/code> and <code>cdr<\/code> of a list are and he doesn\u2019t understand <code>backquotes<\/code>. But he\u2019s 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: <a href=\"https:\/\/www.youtube.com\/watch?v=nPUMHyEGHlU\">he wants to retrieve a list of open pull requests from Github so that he can select one and display it in his browser<\/a>.<\/p>\n<p>There are a lot of moving parts in that exercise. For example, you\u2019ve 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\u2019re not sure where you\u2019re going at every step.<\/p>\n<p>He does that by leveraging Emacs\u2019 discoverability and exploratory programming. First he writes some code just to retrieve a bit of JSON from a site that doesn\u2019t 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 <code>auth-*<\/code> 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.<\/p>\n<p>This is a long video\u2014almost an hour and 23 minutes\u2014and 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 <i>does<\/i> figure those things out. You might even learn something new. For example, I learned about <code>seq-doseq<\/code>, a very useful generalization of <code>dolist<\/code> to arbitrary sequences. The next time you hear someone whine that Elisp is too hard to learn and use, point them to this video.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Geoffrey Lessel is an Elisp n00b. Really a n00b. He\u2019s not sure what the car and cdr of a list are and he doesn\u2019t understand backquotes. But he\u2019s not afraid to dig in and discover things as he goes along. &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=9684\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[26,18],"class_list":["post-9684","post","type-post","status-publish","format-standard","hentry","category-general","tag-elisp","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9684"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9684\/revisions"}],"predecessor-version":[{"id":9685,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9684\/revisions\/9685"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}