From: Lars Ingebrigtsen <larsi@gnus.org>
To: Alex Bochannek <alex@bochannek.com>
Cc: 43413@debbugs.gnu.org
Subject: bug#43413: 28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions
Date: Tue, 15 Sep 2020 14:50:15 +0200 [thread overview]
Message-ID: <875z8f9pbs.fsf@gnus.org> (raw)
In-Reply-To: <m2k0wvbiy9.fsf@bochannek.com> (Alex Bochannek's message of "Tue, 15 Sep 2020 00:25:02 -0700")
Alex Bochannek <alex@bochannek.com> writes:
> Although it's only ~40 lines of Elisp and ~30 lines of Texinfo, I am
> pretty sure it's the largest code change I have submitted to Emacs and I
> would not be surprised if I violated some coding standards. I have spent
> a fair amount of time with testing, but cannot rule out corner cases, of
> course. Let me know if you want me to make any improvements before
> accepting this patch.
Looks pretty good, but the main problem is neglecting to let-bind
variables. byte-compiling is a good way to catch these errors:
In gnus-score-edit-file-at-point:
gnus/gnus-score.el:1190:23: Warning: assignment to free variable `move'
gnus/gnus-score.el:1190:23: Warning: reference to free variable `move'
In gnus-score-func:
gnus/gnus-score.el:1657:35: Warning: assignment to free variable `articles'
gnus/gnus-score.el:1654:36: Warning: assignment to free variable `alist'
gnus/gnus-score.el:1669:46: Warning: reference to free variable `alist'
gnus/gnus-score.el:1655:28: Warning: assignment to free variable `entries'
gnus/gnus-score.el:1655:28: Warning: reference to free variable `entries'
gnus/gnus-score.el:1670:35: Warning: reference to free variable `articles'
gnus/gnus-score.el:1667:32: Warning: assignment to free variable `art'
gnus/gnus-score.el:1659:22: Warning: reference to free variable `art'
gnus/gnus-score.el:1665:53: Warning: assignment to free variable
`article-alist'
gnus/gnus-score.el:1665:67: Warning: assignment to free variable `score'
gnus/gnus-score.el:1665:67: Warning: reference to free variable
`article-alist'
gnus/gnus-score.el:1666:34: Warning: reference to free variable `score'
gnus/gnus-score.el:1666:40: Warning: assignment to free variable `fn-score'
gnus/gnus-score.el:1670:44: Warning: reference to free variable `fn-score'
In end of data:
gnus/gnus-score.el:3146:1: Warning: the function `cl-pairlis' might not be
defined at runtime.
> + (if (string-match "(.*)" rule)
> + (setq move 0) (setq move -1))
Even if the branches here are short, we prefer to write that as
(if (string-match "(.*)" rule)
(setq move 0)
(setq move -1))
Or even better:
(setq move
(if (string-match "(.*)" rule)
0
-1))
> + (dolist (score-fn (cdr entries))
> + (let ((score-fn (car score-fn)))
> + (while (setq art (pop articles))
And this could probably be a
(dolist (art articles)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-09-15 12:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 7:25 bug#43413: 28.0.50; [PATCH] New gnus-score-func to support user-defined scoring functions Alex Bochannek
2020-09-15 12:50 ` Lars Ingebrigtsen [this message]
2020-09-16 18:11 ` Alex Bochannek
2020-09-17 15:03 ` Lars Ingebrigtsen
2020-09-17 17:41 ` Alex Bochannek
2020-09-17 17:43 ` Lars Ingebrigtsen
2020-09-17 20:32 ` Alex Bochannek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875z8f9pbs.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=43413@debbugs.gnu.org \
--cc=alex@bochannek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).