Skip to content

Commit

Permalink
Fix issue #14.
Browse files Browse the repository at this point in the history
Embarrasingly, I forgot to update 'elfeed-score-serde-link-rules'
in 'elfeed-score-serde-load-score-file'-- fixed. Thanks to
@jpowellrussell for pointing it out.
  • Loading branch information
sp1ff committed Apr 29, 2021
1 parent f59cbc3 commit 8c694d0
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 16 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2021-04-28 Michael Herstine <[email protected]>

Fix issue #14.
Embarrasingly, I forgot to update 'elfeed-score-serde-link-rules'
in 'elfeed-score-serde-load-score-file'-- fixed. Thanks to
@jpowellrussell for pointing it out.

2021-03-02 Michael Herstine <[email protected]>

Upgrade the score file on initial load.
Expand Down
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
elfeed-score News -- history of user-visible changes -*- outline -*-

* Changes in elfeed-score 0.7.8

** Bugfixes

** Address issue 12

'link' rules were not being read in correctly--fixed.
* Changes in elfeed-score 0.7.7

** New Features
Expand Down
18 changes: 9 additions & 9 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#+DESCRIPTION: Gnus-style scoring for Elfeed
#+AUTHOR: Michael Herstine
#+EMAIL: [email protected]
#+DATE: <2021-03-02 Tue 08:24>
#+DATE: <2021-04-28 Wed 18:14>
#+AUTODATE: t
#+OPTIONS: toc:nil org-md-headline-style:setext *:t ^:nil

Expand All @@ -17,7 +17,7 @@

[[https://github.com/skeeto/elfeed][Elfeed]] is an extensible web feed reader for Emacs. By default, it will display entries in reverse chronological order. This package defines a bit of metadata for each of your feed entries: a "score". A score is an integer (negative or positive), and higher scores denote entries of greater interest to you. This package also (optionally) installs a new sort function, so that Elfeed will display entries with higher scores before entries with lower scores (entries with the same scores will still be sorted in reverse chronological order). It also provides an entry display function for the elfeed search buffer that displays each entry's score, should you choose to install it.

While you can manually assign a score to an entry, you will likely find it more convenient to create rules for scoring that will be automatically applied to each new entry every time you update Elfeed. You can score against title, feed, content & authors by defining strings that will be matched against those attributes by substring, regexp or whole-word match. You can score against the feed (on the basis of title, URL, or feed author). You can also score against the presence or absence of tags. Rules can be scoped by Elfeed entry tags or by their feed, so that a rule will only be applied to a subset of your entries. Each rule defines an integral value, and the rules are applied in order of definition. The new entry's score begins at zero, and is adjusted by the value defined by each matching scoring rule.
While you can manually assign a score to an entry, you will likely find it more convenient to create rules for scoring that will be automatically applied to each new entry every time you update Elfeed. You can score against title, feed, content, authors & entry link by defining strings that will be matched against those attributes by substring, regexp or whole-word match. You can score against the feed (on the basis of title, URL, or feed author). You can also score against the presence or absence of tags. Rules can be scoped by Elfeed entry tags or by their feed, so that a rule will only be applied to a subset of your entries. Each rule defines an integral value, and the rules are applied in order of definition. The new entry's score begins at zero, and is adjusted by the value defined by each matching scoring rule.

For instance, here's a subset of my scoring file at the moment:

Expand Down Expand Up @@ -71,7 +71,7 @@ The easiest way to install elfeed-score is [[https://github.com/melpa/melpa][MEL
You can also download the Emacs package file on the GitHub releases [[https://github.com/sp1ff/elfeed-score/releases][page]] or from my personal [[https://www.unwoundstack/distros.html][page]]. Then say:

#+BEGIN_SRC elisp
(package-install-file "elfeed-score-0.7.7.tar")
(package-install-file "elfeed-score-0.7.8.tar")
#+END_SRC

** Autotools Source Distributions
Expand All @@ -80,8 +80,8 @@ You can also download Autotools source tarballs (again available either on the G

#+BEGIN_SRC bash
cd /tmp
curl -L --output elfeed-score-0.7.7.tar.gz https://github.com/sp1ff/elfeed-score/releases/download/0.7.7/elfeed-score-0.7.7.tar.gz
tar xvf elfeed-score-0.7.7.tar.gz && cd elfeed-score-0.7.7
curl -L --output elfeed-score-0.7.8.tar.gz https://github.com/sp1ff/elfeed-score/releases/download/0.7.8/elfeed-score-0.7.8.tar.gz
tar xvf elfeed-score-0.7.8.tar.gz && cd elfeed-score-0.7.8
export EMACSLOADPATH=$HOME/.emacs.d/elpa/elfeed-20200209.1942:$EMACSLOADPATH
./configure
make
Expand All @@ -96,16 +96,16 @@ The unit tests require some macros defined by the [[https://github.com/skeeto/el
#+BEGIN_SRC bash
cd /tmp
git clone https://github.com/skeeto/elfeed.git
curl -L --output=elfeed-score-0.7.7.tar.gz https://github.com/sp1ff/elfeed-score/releases/download/0.7.7/elfeed-score-0.7.7.tar.gz
tar xvf elfeed-score-0.7.7.tar.gz && cd elfeed-score-0.7.7
export EMACSLOADPATH=/tmp/elfeed-score-0.7.7:/tmp/elfeed:/tmp/elfeed/tests:$EMACSLOADPATH
curl -L --output=elfeed-score-0.7.8.tar.gz https://github.com/sp1ff/elfeed-score/releases/download/0.7.8/elfeed-score-0.7.8.tar.gz
tar xvf elfeed-score-0.7.8.tar.gz && cd elfeed-score-0.7.8
export EMACSLOADPATH=/tmp/elfeed-score-0.7.8:/tmp/elfeed:/tmp/elfeed/tests:$EMACSLOADPATH
./configure
make
make check
sudo make install
#+END_SRC

Again, unless you already use =EMACSLOADPATH=, you'll need to set =EMACSLOADPATH= appropriately to your system, something like =EMACSLOADPATH=/tmp/elfeed-score-0.7.7:/tmp/elfeed:/tmp/elfeed/tests:/usr/share/emacs/25.2/lisp=.
Again, unless you already use =EMACSLOADPATH=, you'll need to set =EMACSLOADPATH= appropriately to your system, something like =EMACSLOADPATH=/tmp/elfeed-score-0.7.8:/tmp/elfeed:/tmp/elfeed/tests:/usr/share/emacs/25.2/lisp=.

** Building From Source

Expand Down
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
AC_INIT([elfeed-score], [0.7.7], [[email protected]], [elfeed-score], [https://github.com/sp1ff/elfeed-score])
AC_PREREQ([2.69])
AC_INIT([elfeed-score], [0.7.8], [[email protected]], [elfeed-score], [https://github.com/sp1ff/elfeed-score])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([./elfeed-score.el])
AC_PROG_MAKE_SET

AM_INIT_AUTOMAKE([-Wall -Werror gnits std-options dist-bzip2 dist-xz])

Expand Down
4 changes: 2 additions & 2 deletions doc/version.texi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@set UPDATED 2 March 2021
@set UPDATED-MONTH March 2021
@set EDITION 0.7.7
@set VERSION 0.7.7
@set EDITION 0.7.8
@set VERSION 0.7.8
2 changes: 1 addition & 1 deletion elfeed-score-pkg.el
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(define-package
"elfeed-score"
"0.7.7"
"0.7.8"
"Gnus-style scoring for Elfeed"
'((emacs "26.1") (elfeed "3.3.0")))
1 change: 1 addition & 0 deletions elfeed-score-serde.el
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ Read SCORE-FILE, store scoring rules into
elfeed-score-serde-title-or-content-rules (plist-get score-entries :title-or-content)
elfeed-score-serde-tag-rules (plist-get score-entries :tag)
elfeed-score-serde-authors-rules (plist-get score-entries :authors)
elfeed-score-serde-link-rules (plist-get score-entries :link)
elfeed-score-serde-score-mark (plist-get score-entries :mark)
elfeed-score-serde-adjust-tags-rules (plist-get score-entries :adjust-tags))
;; If this is an upgrade in file format; re-write the score file in the new
Expand Down
4 changes: 2 additions & 2 deletions elfeed-score.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Copyright (C) 2019-2021 Michael Herstine <[email protected]>

;; Author: Michael Herstine <[email protected]>
;; Version: 0.7.7
;; Version: 0.7.8
;; Package-Requires: ((emacs "26.1") (elfeed "3.3.0"))
;; Keywords: news
;; URL: https://github.com/sp1ff/elfeed-score
Expand Down Expand Up @@ -43,7 +43,7 @@
(require 'elfeed-score-scoring)
(require 'elfeed-score-maint)

(defconst elfeed-score-version "0.7.7")
(defconst elfeed-score-version "0.7.8")

(defgroup elfeed-score nil
"Gnus-style scoring for Elfeed entries."
Expand Down
2 changes: 1 addition & 1 deletion test/test-serde
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
EMACS=${EMACS:-emacs}
${EMACS} -batch -L ${srcdir}/.. -l ${srcdir}/test-serde.el --eval '(let ((ert-batch-backtrace-right-margin 120)) (ert-run-tests-batch-and-exit t))'
${EMACS} -batch -L . -L ${srcdir}/.. -l ${srcdir}/test-serde.el --eval '(let ((ert-batch-backtrace-right-margin 120)) (ert-run-tests-batch-and-exit t))'
14 changes: 14 additions & 0 deletions test/test-serde.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
(require 'elfeed-lib)
(require 'elfeed-score)
(require 'elfeed-db-tests)
(require 'elfeed-score-tests)

(ert-deftest score-files-smoke-test ()
"Smoke test reading/writing score files.
Expand Down Expand Up @@ -486,5 +487,18 @@ cf. `test-issue-12'."
(eq elfeed-score-serde-current-format
(plist-get (elfeed-score-serde--parse-score-file score-file) :version)))))

(ert-deftest test-issue-14 ()
"Test my fix to issue #14 (and that there is no regression)."
(let* ((score-entries
'((version 7)
("link"
(:text "reddit" :value 30 :type s)
(:text "twitter" :value 30 :type s))))
(score-text (pp-to-string score-entries))
(score-file (make-temp-file "elfeed-score-test-" nil nil score-text)))
(with-elfeed-score-test
(elfeed-score-serde-load-score-file score-file)
(should elfeed-score-serde-link-rules))))

(provide 'test-serde)
;;; test-serde.el ends here

0 comments on commit 8c694d0

Please sign in to comment.