-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcb3121
commit 1aa6f35
Showing
3 changed files
with
76 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: build | ||
on: | ||
pull_request: | ||
paths: | ||
- '!**' | ||
- '.github/workflows/build.yml' | ||
- 'Makefile' | ||
- 'hackernews.el' | ||
push: | ||
paths: | ||
- '!**' | ||
- '.github/workflows/build.yml' | ||
- 'Makefile' | ||
- 'hackernews.el' | ||
permissions: {} | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
emacs_version: | ||
- 23.4 | ||
- 24.1 | ||
- 24.2 | ||
- 24.3 | ||
- 24.4 | ||
- 24.5 | ||
- 25.1 | ||
- 25.2 | ||
- 25.3 | ||
- 26.1 | ||
- 26.2 | ||
- 26.3 | ||
- 27.1 | ||
- 27.2 | ||
- 28.1 | ||
- 28.2 | ||
- 29.1 | ||
- release-snapshot | ||
- snapshot | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- uses: purcell/setup-emacs@master | ||
with: | ||
version: ${{ matrix.emacs_version }} | ||
- name: Byte-compile | ||
run: make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
;;; hackernews.el --- Hacker News Client for Emacs -*- lexical-binding: t -*- | ||
|
||
;; Copyright (C) 2012-2023 The Hackernews.el Authors | ||
;; Copyright (C) 2012-2024 The Hackernews.el Authors | ||
|
||
;; Author: Lincoln de Sousa <[email protected]> | ||
;; Maintainer: Basil L. Contovounesios <[email protected]> | ||
;; Keywords: comm hypermedia news | ||
;; Version: 0.6.1 | ||
;; Homepage: https://github.com/clarete/hackernews.el | ||
;; Version: 0.7.0 | ||
;; URL: https://github.com/clarete/hackernews.el | ||
|
||
;; 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 | ||
|
@@ -383,7 +383,8 @@ On error, display a warning for the user and return nil." | |
(condition-case err | ||
(with-temp-buffer | ||
(insert-file-contents hackernews-visited-links-file) | ||
(read (current-buffer))) | ||
(unless (eobp) | ||
(read (current-buffer)))) | ||
(error | ||
(ignore | ||
(lwarn 'hackernews :error | ||
|
@@ -421,6 +422,18 @@ risks being overwritten next time Emacs is killed." | |
(puthash k newv table)))) | ||
(cdr entry))))) | ||
|
||
(defalias 'hackernews--prin1 | ||
(if (condition-case nil | ||
(with-no-warnings (prin1 t #'ignore ())) | ||
(wrong-number-of-arguments)) | ||
#'prin1 | ||
(lambda (object &optional printcharfun _overrides) | ||
(let ((print-length nil) | ||
(print-level nil)) | ||
(prin1 object printcharfun)))) | ||
"Compatibility shim for default `prin1' overrides in Emacs < 29. | ||
\n(fn OBJECT &optional PRINTCHARFUN OVERRIDES)") | ||
|
||
(defun hackernews-save-visited-links () | ||
"Write visited links to `hackernews-visited-links-file'." | ||
(when hackernews-visited-links-file | ||
|
@@ -430,7 +443,7 @@ risks being overwritten next time Emacs is killed." | |
;; Ensure any parent directories exist | ||
(when dir (make-directory dir t))) | ||
(hackernews-load-visited-links) | ||
(prin1 hackernews--visited-ids (current-buffer))) | ||
(hackernews--prin1 hackernews--visited-ids (current-buffer) t)) | ||
(error (lwarn 'hackernews :error | ||
"Could not write `hackernews-visited-links-file': %s" | ||
(error-message-string err)))))) | ||
|
@@ -489,7 +502,7 @@ which see." | |
;; earlier versions can't return the result of `make-text-button'. | ||
;; Emacs 28.1 started modifying a copy of BEG when it's a string, so | ||
;; subsequent versions must return the result of `make-text-button'. | ||
(if (version< "24.3" emacs-version) | ||
(if (version<= "24.4" emacs-version) | ||
#'make-text-button | ||
(lambda (beg end &rest properties) | ||
(apply #'make-text-button beg end properties) | ||
|
@@ -614,14 +627,16 @@ Official major mode key bindings: | |
|
||
;;;; Retrieval | ||
|
||
;; At top level for Emacs < 24.4. | ||
(defvar json-array-type) | ||
(defvar json-object-type) | ||
(declare-function json-read "json" ()) | ||
|
||
(defalias 'hackernews--parse-json | ||
(if (fboundp 'json-parse-buffer) | ||
(lambda () | ||
(json-parse-buffer :object-type 'alist)) | ||
(require 'json) | ||
(defvar json-array-type) | ||
(defvar json-object-type) | ||
(declare-function json-read "json") | ||
(lambda () | ||
(let ((json-array-type 'vector) | ||
(json-object-type 'alist)) | ||
|