From 261140a5f80052c5642839ac9958e01db3326840 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Fri, 12 Jan 2024 15:41:39 +0100 Subject: [PATCH] [WIP] --- .github/workflows/build.yml | 50 +++++++++++++++++++++++++++++++++++++ README.md | 4 +-- hackernews.el | 23 +++++++++++++---- 3 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7377e9d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +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 diff --git a/README.md b/README.md index bcfd574..fee3239 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ News](https://news.ycombinator.com/). It uses a HTTP ## Interface -Version 0.6.1 of the `hackernews` package is able to fetch stories +Version 0.7.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. @@ -172,7 +172,7 @@ possibility for mitigation can be investigated. ## License -Copyright (C) 2012-2023 The Hackernews.el Authors +Copyright (C) 2012-2024 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 diff --git a/hackernews.el b/hackernews.el index bfa2f12..176c3d7 100644 --- a/hackernews.el +++ b/hackernews.el @@ -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 ;; Maintainer: Basil L. Contovounesios ;; 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))))))