Skip to content

Commit

Permalink
Resolve issue #22.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Herstine committed Apr 28, 2022
1 parent 3448413 commit 419de17
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 21 deletions.
18 changes: 18 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2022-04-27 Michael Herstine <michael@lithic>

Resolve issue #22.

2022-02-01 Michael Herstine <[email protected]>

Merge branch 'master' of github.com:sp1ff/elfeed-score

2022-02-01 Michael Herstine <[email protected]>

Fix issue #21.
Expand All @@ -13,6 +21,16 @@
This commit *also* fixes a few lints and updates the copyright
years throughout.

2021-12-30 Michael <[email protected]>

Merge pull request #20 from fclaude/patch-1
Fix example for setting debug mode

2021-12-29 Francisco Claude <[email protected]>

Fix example for setting debug mode
The example in the documentation contains a duplicated `-log` in the variable name.

2021-11-23 Michael Herstine <[email protected]>

Updating the version post-merge because I accidentally tagged the alpha release.
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ elfeed-score News -- history of user-visible changes -*- outline -*-

* elfeed-score 1.2

** changes in elfeed-score 1.2.3

*** address issue 22

'adjust-tags' rules just didn't work due to an embarassing omission on my part.
** changes in elfeed-score 1.2.2

*** update copyright statements
Expand Down
16 changes: 8 additions & 8 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: <2022-02-01 Tue 17:40>
#+DATE: <2022-04-27 Wed 18:01>
#+AUTODATE: t
#+OPTIONS: toc:nil org-md-headline-style:setext *:t ^:nil
#+STARTUP: overview
Expand Down Expand Up @@ -73,7 +73,7 @@ The easiest way to install elfeed-score is [[https://github.com/melpa/melpa][MEL
If you would prefer to install the package manually, 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-1.2.2.tar")
(package-install-file "elfeed-score-1.2.3.tar")
#+END_SRC

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

#+BEGIN_SRC bash
cd /tmp
curl -L --output elfeed-score-1.2.2.tar.gz https://github.com/sp1ff/elfeed-score/releases/download/1.2.2/elfeed-score-1.2.2.tar.gz
tar xvf elfeed-score-1.2.2.tar.gz && cd elfeed-score-1.2.2
curl -L --output elfeed-score-1.2.3.tar.gz https://github.com/sp1ff/elfeed-score/releases/download/1.2.3/elfeed-score-1.2.3.tar.gz
tar xvf elfeed-score-1.2.3.tar.gz && cd elfeed-score-1.2.3
export EMACSLOADPATH=$HOME/.emacs.d/elpa/elfeed-20200209.1942:$EMACSLOADPATH
./configure
make
Expand All @@ -98,16 +98,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-1.2.2.tar.gz https://github.com/sp1ff/elfeed-score/releases/download/1.2.2/elfeed-score-1.2.2.tar.gz
tar xvf elfeed-score-1.2.2.tar.gz && cd elfeed-score-1.2.2
export EMACSLOADPATH=/tmp/elfeed-score-1.2.2:/tmp/elfeed:/tmp/elfeed/tests:$EMACSLOADPATH
curl -L --output=elfeed-score-1.2.3.tar.gz https://github.com/sp1ff/elfeed-score/releases/download/1.2.3/elfeed-score-1.2.3.tar.gz
tar xvf elfeed-score-1.2.3.tar.gz && cd elfeed-score-1.2.3
export EMACSLOADPATH=/tmp/elfeed-score-1.2.3:/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-1.2.2:/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-1.2.3:/tmp/elfeed:/tmp/elfeed/tests:/usr/share/emacs/25.2/lisp=.
** Building From Source

Finally, you can of course just clone this repo & build there. I've started a [[https://github.com/sp1ff/elfeed-score/wiki][wiki]], whose intended audience are people looking to hack on elfeed-score, that includes build instructions.
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AC_PREREQ([2.69])
AC_INIT([elfeed-score], [1.2.2], [[email protected]], [elfeed-score], [https://github.com/sp1ff/elfeed-score])
AC_INIT([elfeed-score], [1.2.3], [[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
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 February 2022
@set UPDATED-MONTH February 2022
@set EDITION 1.2.2
@set VERSION 1.2.2
@set EDITION 1.2.3
@set VERSION 1.2.3
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"
"1.2.2"
"1.2.3"
"Gnus-style scoring for Elfeed"
'((emacs "26.1") (elfeed "3.3.0")))
2 changes: 1 addition & 1 deletion elfeed-score-scoring.el
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ On match, ON-MATCH will be called with the matching rule."
(let* ((thresh (elfeed-score-adjust-tags-rule-threshold adj-tags))
(threshold-switch (car thresh))
(threshold-value (cdr thresh)))
(if (or (and threshold-switch )
(if (or (and threshold-switch (>= score threshold-value))
(and (not threshold-switch) (<= score threshold-value)))
(let* ((rule-tags (elfeed-score-adjust-tags-rule-tags adj-tags))
(rule-switch (car rule-tags))
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-2022 Michael Herstine <[email protected]>

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

(defconst elfeed-score-version "1.2.2")
(defconst elfeed-score-version "1.2.3")

(defgroup elfeed-score nil
"Gnus-style scoring for Elfeed entries."
Expand Down
37 changes: 31 additions & 6 deletions test/test-scoring.el
Original file line number Diff line number Diff line change
Expand Up @@ -504,18 +504,43 @@ parameter."
(stats2 (elfeed-score-rule-stats-get (nth 0 elfeed-score-serde-udf-rules)))
(stats3 (elfeed-score-rule-stats-get (nth 1 elfeed-score-serde-udf-rules)))
(stats4 (elfeed-score-rule-stats-get (nth 2 elfeed-score-serde-udf-rules))))
(message "CP1")
(should (eq score 3))
(message "CP2")
(should (eq 1 (elfeed-score-rule-stats-hits stats1)))
(message "CP3: %s" stats2)
(should (eq 0 (elfeed-score-rule-stats-hits stats2)))
(message "CP4")
(should (eq 1 (elfeed-score-rule-udf-stats-errors stats2)))
(message "CP5")
(should (eq nil stats3)) ;; never matches, no errors => no stats
(message "CP6")
(should (eq 1 (elfeed-score-rule-stats-hits stats4)))))))))

(ert-deftest test-issue-22 ()
"Regression test for Github issue #22."

(let* ((lorem-ipsum "Lorem ipsum dolor sit amet")
(entry-title "foo bar splat"))
(with-elfeed-test
(let* ((feed (elfeed-test-generate-feed))
(entry (elfeed-score-test-generate-entry
feed entry-title lorem-ipsum)))
(elfeed-db-add entry)
;; case-insensitive
(with-elfeed-score-test
(let* ((elfeed-score-serde-title-rules
;; This was a bug where tags meant to be set above a certain score were applied to ALL entries.
;; So, setup a list with a matching title rule that will give the entry a score of 10. Then
;; setup two adjust-tags rules: one that should match & one that should not.
(list (elfeed-score-title-rule--create :text "Bar" :value 10 :type 's)))
(elfeed-score-serde-adjust-tags-rules
(list
(elfeed-score-adjust-tags-rule--create :threshold '(t . 10) :tags '(t . (a)))
(elfeed-score-adjust-tags-rule--create :threshold '(t . 11) :tags '(t . (b)))))
(score (elfeed-score-scoring-score-entry entry))
(tags-stats (elfeed-score-rule-stats-get (car elfeed-score-serde-adjust-tags-rules))))
;; Ho-kay. The entry score should be 10...
(should (eq score 10))
;; we should have ONE adjust-tags rule hit...
(should (eq 1 (elfeed-score-rule-stats-hits tags-stats)))
(let ((tags (elfeed-entry-tags entry)))
(should (memq 'a tags))
(should (not (memq 'b tags))))))))))

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

0 comments on commit 419de17

Please sign in to comment.