• Stars
    star
    247
  • Rank 163,134 (Top 4 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created almost 12 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Hacker News client for Emacs

Simple Hacker News Emacs Client

MELPA MELPA Stable

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

Interface

Version 0.6.1 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

Key Description
RET Open link in default (external) browser
t Open link in text-based browser within Emacs
r Mark link as visited
R Mark link as unvisited
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-50g 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 the built-in package manager

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

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)

Note that this will follow the bleeding edge of hackernews development. Though hackernews contributors make every effort to keep the latest snapshot usable and bug-free, to err is human. If this thought scares you, a more stable experience can be achieved by replacing:

'("melpa" . "https://melpa.org/packages/")

in the example above with:

'("melpa-stable" . "https://stable.melpa.org/packages/")

or equivalent. See https://melpa.org/#/getting-started/ for more on this.

Once package.el is configured, you can run M-xpackage-installREThackernewsRET.

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-xhackernewsRET. 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-xhackernews-top-storiesRET or M-xhackernews-ask-storiesRET. 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-xcustomize-groupREThackernewsRET.

All hackernews buffers are displayed using the pop-to-buffer function for increased compatibility and customizability in how windows and frames are re/used. This function displays buffers in a new window by default. The simplest way to instead reuse the current window for hackernews buffers is to customize one of the user options same-window-buffer-names, same-window-regexp or in Emacs 24 and subsequent versions, display-buffer-alist via M-xcustomize-groupRETwindowsRET.

If you prefer to roll out your own Elisp, you could add to your user-init-file something as simple as:

(push '("\\`\\*hackernews .*\\*\\'" (display-buffer-same-window))
      display-buffer-alist)

Troubleshooting

In general, errors and misbehavior pertaining to network retrieval and JSON parsing are probably due to bugs in older Emacsen. The minimum recommended Emacs version for hackernews is 25. Emacs 24 should work, but suffers from network security vulnerabilities that were fixed in version 25. Emacs 23 is no longer officially supported as of 2018-06-08.

In any case, please report any problems on the project's issue tracker, so that the possibility for mitigation can be investigated.

License

Copyright (C) 2012-2023 The Hackernews.el Authors

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/.

More Repositories

1

forbiddenfruit

Patch built-in python objects
Python
814
star
2

curdling

Concurrent package manager for Python
Python
276
star
3

s3sync

Tool belt for managing your S3 buckets
Ruby
262
star
4

muttrc

Everything I need to run mutt as a decent mail client
38
star
5

eosd

Emacs Notification Daemon
Emacs Lisp
27
star
6

effigy

Small language that compiles to Python37 bytecode
JavaScript
14
star
7

dotfiles

My dotfiles
Shell
7
star
8

pnad

Extraindo informações da PNAD2013
Python
5
star
9

emailverifier

Verify if email addresses exist with SMTP
Python
5
star
10

emacs.d

My Emacs configuration
Emacs Lisp
5
star
11

xmpp-shell

A very simple xmpp shell based on libstrophe
C
4
star
12

bubblesgame

Small Game made with Lua and Love
Lua
4
star
13

langlang

Language Toolkit
Rust
4
star
14

nestk

Nintendo Entertainment System and Java Script shaken in the same bowl
JavaScript
3
star
15

fate

Keep track of what the gods have whispered you to do while you're on your computer
Python
3
star
16

emacs-search-kit

Emacs Search Kit
Emacs Lisp
2
star
17

bitu

A simple, generic and extensible multi-protocol bot writen in C
C
2
star
18

duende

Python
2
star
19

estudos

Campinho de futebol atrás do corrégo pra treinar os fundamentos da computacão
Python
2
star
20

ratpoison

Non official ratpoison clone
C
2
star
21

dojo

learn systems fundamentals with tests
TypeScript
2
star
22

taningia

A generic C library with a lot of cool features, including an xmpp client
C
2
star
23

ucam

Watch your stuff
Rust
1
star
24

clarete.github.io

My website
HTML
1
star
25

todoable

Ruby Wrapper for the Todoable API by Teachable
Ruby
1
star
26

psbrowser

A generic xmpp pubsub browser
Vala
1
star
27

chezzy

Chess Game
HTML
1
star
28

minimal-react-structure

The bare minimum react setup
JavaScript
1
star
29

atomjs

implementation of the atom standard in javascript (RFC 4287)
JavaScript
1
star
30

clarete-dev.github.io

source code of clarete.dev website
HTML
1
star
31

lua-couchdb

CouchDB bindings for Lua
Lua
1
star
32

milieu

A helping hand to manage settings for multiple environments
Python
1
star
33

ratcursor

A small ratpoison helper to select frames with the rat
C
1
star