Motivation

Usually when I consume my daily news feeds, I prefer to keep context switching to a minimum. Whether you’re a busy professional or just someone who values their time, you might want to streamline your online reading experience as much as possible. For me, this means sticking to Emacs and using tools like elfeed and pocket-reader to stay on top of my reading list.

Unfortunately, this approach doesn’t work with content served within comments at Hackernews or Reddit, where you usually have lots of comments and discussion threads. This is where I began to struggle, as I found myself bouncing back and forth between Emacs and my browser in order to stay on top of the conversation.

Luckily, I’ve found hnreader and reddigg which have changed the way I consume content on these platforms. These packages are specifically designed to help you navigate and read through Hackernews and Reddit threads directly from within Emacs, saving you from the hassle of constantly switching between different apps and tabs.

In my opinion these are the most underrated packages and in this post I’d like to show you how they can help you improve your reading experience. By the end of this post, you’ll have a better understanding of how to use hnreader and reddigg to read and navigate through even the most complex Hackernews and Reddit threads, all without ever having to leave the comfort of Emacs.

hnreader

Without any customizations you can use hnreader straightaway. Currently you have following options:

Invoking each function will return a buffer with the latest 30 posts in that category:

Let’s have a look how we can add customized behaviour.

Basic functions

The easiest way to show comments for a thread ID is to use

1
(hnreader-readpage-promise "https://news.ycombinator.com/item?id=34482433")
Code Snippet 1: Open a new buffer with the HN page

This will create a new buffer and load the readpage for that specific HN URL

1
(hnreader-promise-comment "https://news.ycombinator.com/item?id=34482433")
Code Snippet 2: Open a new buffer with the HN threads

This will create a new buffer and load all comments from this specific Hackernews thread:

elfeed integrations

Whenever you have a Hackernews specific link inside your buffer you may want to open it using:

1
2
3
4
5
(defun my/elfeed-hn-show-comments-at-point ()
  "Show HN comments for an URL at point"
  (interactive)
  (setq-local hnreader-view-comments-in-same-window t)
  (hnreader-comment (format "%s" (url-get-url-at-point))))
Code Snippet 1: Show HN comments for an URL at point

You can of course call a function from the elfeed-search buffer to show the HN threads:

1
2
3
4
5
6
7
8
(defun my/elfeed-hn-show-commments (&optional link)
  (interactive)
  (let* ((entry (if (eq major-mode 'elfeed-show-mode)
                    elfeed-show-entry
                  (elfeed-search-selected :ignore-region)))
         (link (if link link (elfeed-entry-link entry))))
    (setq-local hnreader-view-comments-in-same-window nil)
    (hnreader-promise-comment (format "%s" link))))
Code Snippet 1: Opens new buffer when called from the elfeed-search buffer

And these are my elfeed related keybindings:

1
2
3
4
5
6
7
8
(map! :map elfeed-search-mode-map
      :after elfeed-search
      [remap kill-this-buffer] "q"
      [remap kill-buffer] "q"
      :n doom-leader-key nil
      ;; ...
      :n "H" #'my/elfeed-hn-show-commments
      ;; ...)
Code Snippet 1: Key bindings for elfeed-search-mode
1
2
3
4
5
6
7
8
(map! :map elfeed-search-mode-map
      :after elfeed-show
      [remap kill-this-buffer] "q"
      [remap kill-buffer] "q"
      :n doom-leader-key nil
      ;; ...
      :n "H" #'my/elfeed-hn-show-comments-at-point
      ;; ...)
Code Snippet 1: Key bindings for elfeed-show-mode

reddigg

reddigg is the similar solution for reddit. When invoked directly you have these options:

After invoking reddigg-view-frontpage you’ll get a new buffer with the last posts:

1
2
3
4
5
6
7
(defun my/elfeed-reddit-show-commments (&optional link)
  (interactive)
  (let* ((entry (if (eq major-mode 'elfeed-show-mode)
                    elfeed-show-entry
                  (elfeed-search-selected :ignore-region)))
         (link (if link link (elfeed-entry-link entry))))
    (reddigg-view-comments link)))

elfeed integration

We can also use reddigg to show reddit threads from within an elfeed buffer

1
2
3
4
5
6
7
(defun my/elfeed-reddit-show-commments (&optional link)
  (interactive)
  (let* ((entry (if (eq major-mode 'elfeed-show-mode)
                    elfeed-show-entry
                  (elfeed-search-selected :ignore-region)))
         (link (if link link (elfeed-entry-link entry))))
    (reddigg-view-comments link)))
Code Snippet 1: Show reddit comments from within elfeed

And my related keybindings:

1
2
3
4
5
6
7
8
(map! :map elfeed-search-mode-map
      :after elfeed-search
      [remap kill-this-buffer] "q"
      [remap kill-buffer] "q"
      :n doom-leader-key nil
      ;; ...
      :n "R" #'my/elfeed-reddit-show-commments
      ;; ...
Code Snippet 1: Key bindings for reddigg

When invoked you’ll get an ORG mode styled buffer with all the comments for a specific reddit thread:

Conclusion

I hope you’re as enthusiastic as I am. And if you have any better alternatives, please don’t hesitate to let me know in the comments.