From: Mark Walters Date: Tue, 6 May 2014 16:08:24 +0000 (+0100) Subject: Re: Improving spam-tagging keybinding function to act on region in emacs X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6fca83d866a194084355aaa07ed0d2c8b7f85e37;p=notmuch-archives.git Re: Improving spam-tagging keybinding function to act on region in emacs --- diff --git a/93/e238b79edafafc194cc11054ebe4e046a73f6a b/93/e238b79edafafc194cc11054ebe4e046a73f6a new file mode 100644 index 000000000..3ee4485fd --- /dev/null +++ b/93/e238b79edafafc194cc11054ebe4e046a73f6a @@ -0,0 +1,116 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 03652431FD4 + for ; Tue, 6 May 2014 09:08:37 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.502 +X-Spam-Level: +X-Spam-Status: No, score=0.502 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id VIcGTPMOHuuy for ; + Tue, 6 May 2014 09:08:32 -0700 (PDT) +Received: from mail1.qmul.ac.uk (mail1.qmul.ac.uk [138.37.6.7]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 6F9CF431FC7 + for ; Tue, 6 May 2014 09:08:32 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail1.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1Whhus-0002yU-0u; Tue, 06 May 2014 17:08:28 +0100 +Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1Whhur-0000Gq-QY; Tue, 06 May 2014 17:08:25 +0100 +From: Mark Walters +To: Olivier Berger , + notmuch@notmuchmail.org +Subject: Re: Improving spam-tagging keybinding function to act on region in + emacs +In-Reply-To: <87oazb9k5f.fsf@inf-8660.int-evry.fr> +References: <87oazb9k5f.fsf@inf-8660.int-evry.fr> +User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Tue, 06 May 2014 17:08:24 +0100 +Message-ID: <87mweuzy87.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 87.81.223.162 +X-QM-Geographic: According to ripencc, + this message was delivered by a machine in Britain (UK) (GB). +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: d0c3c06fab8d99812b284de35dba8d79 (of first 20000 bytes) +X-SpamAssassin-Score: -0.1 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -0.1 points. + Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.1 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 06 May 2014 16:08:37 -0000 + + +Hello + +As this section was rather outdated I have updated to modern notmuch. (In +fact the lisp snippets should work back to at least 0.13) + +On Tue, 06 May 2014, Olivier Berger wrote: +> Hi. +> +> I've tried tu use the tips indicated at +> http://notmuchmail.org/emacstips/#index8h2 so as to add a keybinding to +> tag spam messages, and wonder if there's a possibility to make it apply +> on selected regions, like what notmuch-search-archive-thread does. + +I have added a snippet showing how to do this (and noted that is not +possible in notmuch-tree as we don't have a tag region option there). + +> I can achieve the same result using a macro to iterate over lines, but a +> single key press to tag results of a search filter would be quite +> convienent. +> +> And... at the moment, it seems to me that with the current suggested +> lambdas, if one presses 'S' after selecting a whole region results in +> tagging all sorts of messages (all ?) with the spam tag ! :-/ +> +> +> Btw, I think that the current examples could be improved by adding a (next-line) +> at the end, like : +> (define-key notmuch-search-mode-map "S" +> (lambda () +> "mark messages in thread as spam" +> (interactive) +> (notmuch-search-tag '("+spam" "-inbox")) +> (next-line))) + +I have left this as it is as this works in search mode, but not show +mode and I didn't want to have too many examples. Obviously feel free to +edit the wiki if you like! + + +Best wishes + +Mark