3.2.7 adjust-tags Rules

Until now, all the rules have been used to determine an entry’s score. The “adjust-tags” rule (and the “mark” rule below) act on entries after their scores have been determined.

The adust-tags rule was inspired by John Kitchin’s article Scoring Elfeed Articles. He computes a score and adds one or two tags to entries whose score is sufficiently high. It always bothered me that elfeed-score couldn’t do that, so in build 0.4.3, I added this rule type. These will add or remove tags based on whether the entry’s score is above or below a given threshold.

adjust-tags rules are given by four properties:

  1. :threshold: The threshold at which the rule shall apply

    This is defined by a cons cell (see cons cell in Emacs Lisp) of the form:

    (switch . threshold)
    

    switch may be t or nil and threshold is the threshold against which each entry’s score shall be compared. If switch is t, the rule applies if the score is greater than or equal to threshold; if switch is nil the rule applies if score is less than or equal to threshold.

  2. :tags: The tags to be added or removed

    This is also given by a cons cell

    (switch . tags)
    

    If switch is t & the rule applies, tags (either a single tag or a list of tags) will be added to the entry; if switch is nil, they will be removed

  3. :date: Last match time

    The last time this rule matched an entry, in seconds since Unix epoch. This element is optional, need not be supplied by the score file author, and will be automatically kept up-to-date by the package.

  4. :hits: Hit count

    The number of times this rule has matched an entry. This element is optional, need not be supplied by the score file author, and will be automatically kept up-to-date by the package.

For example, the following rules:

(("adjust-tags"
  (:threshold (t . 1000) :tags (t . a))
  (:threshold (nil . -1000) :tags (nil . b)))

will add the tag 'a to all entries whose score is 1000 or more, and remove tag 'b from all entries whose score is -1000 or less.