Skip to content

novakboskov/hackernews.el

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Hacker News Emacs Client

It's simple because it doesn't actually interact with Hacker News. It uses a HTTP API to get the data.

Interface

Version 0.4.0 of the hackernews package is able to fetch stories from six different Hacker News feeds, namely top, new, best, ask, show and job stories. The default feed is top stories, which corresponds to the Hacker News homepage.

The score, title, and comments count of each story is presented on a line of its own (see screenshot below), though this format is customizable. Both the title and comments count strings are hyperlinked to the Hacker News page for the item (the one with the comments), unless the story links to an external page, in which case the title is hyperlinked to that instead.

Clicking or typing RET on a link opens it with the command browse-url, which selects a browser based on the user option browse-url-browser-function. This defaults to the system's default browser.

Typing t on a link first tries to open it in eww, if available, and otherwise passes it to the command browse-url-text-emacs, which consults the user option browse-url-text-browser. This defaults to running lynx within Emacs. Keep in mind that some websites do not render well in text mode.

A future hackernews version may support upvoting and interacting with comments.

Keymap

Keybinding Description
RET Open link in default (external) browser
t Open link in text-mode browser within Emacs
n Move to next title link
p Move to previous title link
TAB Move to next comments count link
S-TAB Move to previous comments count link
m Load more stories
g Reload stories
f Prompt user for a feed to switch to
q Quit

All feed re/loading commands accept an optional numeric prefix argument denoting how many stories to act on. For example, M-5 0 g refreshes the feed of the current hackernews buffer and fetches its top 50 stories. With no prefix argument, the value of the user option hackernews-items-per-page is used instead.

Screenshot

screenshot

Installation

Using built-in package manager

Those who like the built-in package manager package.el need only point it to the Marmalade repository, which can be achieved by adding the following code to your user-init-file:

(require 'package)
(add-to-list 'package-archives
             '("marmalade" .
               "http://marmalade-repo.org/packages/"))
(package-initialize)

Then you can run M-x package-install RET hackernews RET.

Manual download

Place the hackernews.el file into a directory on your load-path and add the following code to your user-init-file:

(autoload 'hackernews "hackernews" nil t)

Alternatively, if you always want the package loaded at startup (this slows down startup):

(require 'hackernews)

Usage

Just run M-x hackernews RET. This reads the feed specified by the user option hackernews-default-feed, which defaults to top stories, i.e. the Hacker News homepage. A direct command for each supported feed is also supported, e.g. M-x hackernews-top-stories RET or M-x hackernews-ask-stories RET. These direct commands are not autoloaded, however, so to use them before hackernews has been loaded you should autoload them yourself, e.g. by adding the following to your user-init-file:

(autoload 'hackernews-ask-stories "hackernews" nil t)

Customization

You can list and modify all custom faces and variables by typing M-x customize-group RET hackernews RET.

License

Copyright (C) 2012-2017 Lincoln de Sousa lincoln@comum.org

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

instanc.es Badge Bitdeli Badge

About

Hacker News client for Emacs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 97.7%
  • Makefile 2.3%