[PATCH 0/1] RFC: add attachment checks
anarcat at debian.org
Mon Sep 3 10:57:11 PDT 2018
This is a re-issue of my "attachment checks" patch, which failed to
raise comments or interest in its last round. I'm resubmitting it in
the hope it will fare better this time around.
This code is working: I use it daily and never worry about missing
attachments anymore. It did catch a few occurences but also a few
false positives, which I did not mind.
There are still no unit tests: bremner suggested I add some in
test/T310-emacs.sh and I looked there briefly, but couldn't figure out
where to add a blurb. I would need help to complete this.
I did some summary tests using `re-builder' to see the effect the
regex has on random strings. I tested the possible false positive "a
joint attachÃ© presse" which doesn't match and "here is an attachment,
attached in the piÃ¨ce jointe or piece jointe" which does. I am not
sure how to implement this in a unit test: should we try to send an
email and check if it aborts like the "Sending a message via (fake)
SMTP" test? Or should I just check that `notmuch-message-check-attach'
works against a temporary buffer? Is there a harness that allows
matching against messages like that already?
I'd also welcome comments on the approach in general. Another user
came up on IRC recently (impatkor) with the same need and used the
following snippet instead:
It is a very similar implementation although it checks for
`Content-Disposition: attachment` instead of `<#part>`: not sure which
one is actually accurate. It also adds the word `bifoga` as a pattern,
but I haven't verified that in swedish and would wait for feedback on
the multilingual approach before adding new words here.
Finally, note that an earlier version of this used
`save-mark-and-excursion` but I had to revert back to `save-excursion`
because the function was missing in some other version of Emacs I was
testing. That part does not work anyways: something else is moving the
mark around when sending, but I figured I would keep this hook
well-behaving even if others screw that up. I did remove the "XXX"
note there because there's nothing else to do on that front.
Antoine BeauprÃ© (1):
RFC: add attachment checks
emacs/notmuch-message.el | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
More information about the notmuch