Re: Improving spam-tagging keybinding function to act on region in emacs
authorMark Walters <markwalters1009@gmail.com>
Thu, 22 May 2014 08:06:54 +0000 (09:06 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:02:55 +0000 (10:02 -0800)
61/f39df00ae76149ef7676047f7d18ca9151e30d [new file with mode: 0644]

diff --git a/61/f39df00ae76149ef7676047f7d18ca9151e30d b/61/f39df00ae76149ef7676047f7d18ca9151e30d
new file mode 100644 (file)
index 0000000..417a701
--- /dev/null
@@ -0,0 +1,151 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 57EDE431FBC\r
+       for <notmuch@notmuchmail.org>; Thu, 22 May 2014 01:07:04 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id IbY8R0D9z04m for <notmuch@notmuchmail.org>;\r
+       Thu, 22 May 2014 01:06:57 -0700 (PDT)\r
+Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com\r
+       [209.85.212.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id B2926431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 22 May 2014 01:06:57 -0700 (PDT)\r
+Received: by mail-wi0-f172.google.com with SMTP id hi2so8811246wib.11\r
+       for <notmuch@notmuchmail.org>; Thu, 22 May 2014 01:06:56 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=Vdr0qdRAS3HMEiAeYxsS01OVmI8i8agNKmcQ+WI1iWk=;\r
+       b=XrwubSY/q3QtlGwkhIQQduBzARtSOcItaAV/8hzvlH2duV32QRoH4XJwCCFdmaaLbB\r
+       IPzVaJ2VGzQ74COfk17qcwd+jOqK5AL6LBWWk9WwMiLHHtcUCdzw7lCaryCgJCvLK7ot\r
+       KGJix9QqlISoUou3e/Soe+pIcayjeQYbs2m5PcBDqAz2YzBy4dZaKfXbuziLzi4Zq/Vo\r
+       AkoCGR68XrIoTWepASnLN1kTlCYeKqWDrk1Y3nlOFduN2BmK2V6sli1eLBvhkuotVfDP\r
+       i2YQ4oNHKVLA0dGsfzHb3mFuN1cEpExHGeJwjtny+QQWBUNQQJ+U/d/ZLJCIt0UwZzm4\r
+       Z9qg==\r
+X-Received: by 10.180.84.226 with SMTP id c2mr15085697wiz.50.1400746016438;\r
+       Thu, 22 May 2014 01:06:56 -0700 (PDT)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+       by mx.google.com with ESMTPSA id iy13sm6616144wic.1.2014.05.22.01.06.55\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Thu, 22 May 2014 01:06:55 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Olivier Berger <olivier.berger@telecom-sudparis.eu>,\r
+       notmuch@notmuchmail.org\r
+Subject: Re: Improving spam-tagging keybinding function to act on region in\r
+       emacs\r
+In-Reply-To: <87bnv92521.fsf@inf-8660.int-evry.fr>\r
+References: <87oazb9k5f.fsf@inf-8660.int-evry.fr> <87mweuzy87.fsf@qmul.ac.uk>\r
+       <87bnv92521.fsf@inf-8660.int-evry.fr>\r
+User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Thu, 22 May 2014 09:06:54 +0100\r
+Message-ID: <87wqde6xup.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 22 May 2014 08:07:04 -0000\r
+\r
+On Wed, 07 May 2014, Olivier Berger <olivier.berger@telecom-sudparis.eu> wrote:\r
+> Hi.\r
+>\r
+> Mark Walters <markwalters1009@gmail.com> writes:\r
+>\r
+>> Hello\r
+>>\r
+>> As this section was rather outdated I have updated to modern notmuch. (In\r
+>> fact the lisp snippets should work back to at least 0.13)\r
+>>\r
+>> On Tue, 06 May 2014, Olivier Berger <olivier.berger@telecom-sudparis.eu> wrote:\r
+>>> Hi.\r
+>>>\r
+>>> I've tried tu use the tips indicated at\r
+>>> http://notmuchmail.org/emacstips/#index8h2 so as to add a keybinding to\r
+>>> tag spam messages, and wonder if there's a possibility to make it apply\r
+>>> on selected regions, like what notmuch-search-archive-thread does.\r
+>>\r
+>> I have added a snippet showing how to do this (and noted that is not\r
+>> possible in notmuch-tree as we don't have a tag region option there).\r
+>>\r
+>\r
+> Thanks. This works exactly I like it :-)\r
+>\r
+>>> Btw, I think that the current examples could be improved by adding a (next-line)\r
+>>> at the end, like :\r
+>>> (define-key notmuch-search-mode-map "S"\r
+>>>         (lambda ()\r
+>>>           "mark messages in thread as spam"\r
+>>>           (interactive)\r
+>>>           (notmuch-search-tag '("+spam" "-inbox"))\r
+>>>           (next-line)))\r
+>>\r
+>> I have left this as it is as this works in search mode, but not show\r
+>> mode and I didn't want to have too many examples. Obviously feel free to\r
+>> edit the wiki if you like!\r
+>>\r
+>\r
+> Note that I'm now using the following :\r
+>   (define-key notmuch-search-mode-map "S"\r
+>         (lambda (&optional beg end)\r
+>           "mark messages in thread as spam"\r
+>           (interactive (notmuch-search-interactive-region))\r
+>           (notmuch-search-tag '("+spam" "-inbox") beg end)\r
+>           (if (eq beg end) (notmuch-search-next-thread))))\r
+>\r
+> This offers the possibility to jump to the next line when tagging\r
+> individual lines, and not do so when acting on a region.\r
+>\r
+> Btw, such a difference in behaviour may be a tiny, but still nice\r
+> improvement on the code of notmuch-search-archive-thread too.\r
+\r
+I think this is worth doing: do you want to send a patch? The above lisp\r
+is fine but I would replace the "if" by "when". (The main difference is\r
+that "when" cannot take an else clause so using when flags up that there\r
+is not an else clause.)\r
+\r
+If the above is inconvenient then I am happy to post such a patch.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+>\r
+> I haven't touched the wiki, as I'm not sure this is the best way to\r
+> write it and everyone would be interested.\r
+>\r
+> Hope this helps.\r
+>\r
+> Best regards,\r
+>\r
+> -- \r
+> Olivier BERGER \r
+> http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8\r
+> Ingenieur Recherche - Dept INF\r
+> Institut Mines-Telecom, Telecom SudParis, Evry (France)\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r