From: Mark Walters Date: Thu, 22 May 2014 08:06:54 +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=c5f16e4099cc8c71ed45643f67f97f13a4dc3008;p=notmuch-archives.git Re: Improving spam-tagging keybinding function to act on region in emacs --- diff --git a/61/f39df00ae76149ef7676047f7d18ca9151e30d b/61/f39df00ae76149ef7676047f7d18ca9151e30d new file mode 100644 index 000000000..417a70129 --- /dev/null +++ b/61/f39df00ae76149ef7676047f7d18ca9151e30d @@ -0,0 +1,151 @@ +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 57EDE431FBC + for ; Thu, 22 May 2014 01:07:04 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 IbY8R0D9z04m for ; + Thu, 22 May 2014 01:06:57 -0700 (PDT) +Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com + [209.85.212.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B2926431FAE + for ; Thu, 22 May 2014 01:06:57 -0700 (PDT) +Received: by mail-wi0-f172.google.com with SMTP id hi2so8811246wib.11 + for ; Thu, 22 May 2014 01:06:56 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type; + bh=Vdr0qdRAS3HMEiAeYxsS01OVmI8i8agNKmcQ+WI1iWk=; + b=XrwubSY/q3QtlGwkhIQQduBzARtSOcItaAV/8hzvlH2duV32QRoH4XJwCCFdmaaLbB + IPzVaJ2VGzQ74COfk17qcwd+jOqK5AL6LBWWk9WwMiLHHtcUCdzw7lCaryCgJCvLK7ot + KGJix9QqlISoUou3e/Soe+pIcayjeQYbs2m5PcBDqAz2YzBy4dZaKfXbuziLzi4Zq/Vo + AkoCGR68XrIoTWepASnLN1kTlCYeKqWDrk1Y3nlOFduN2BmK2V6sli1eLBvhkuotVfDP + i2YQ4oNHKVLA0dGsfzHb3mFuN1cEpExHGeJwjtny+QQWBUNQQJ+U/d/ZLJCIt0UwZzm4 + Z9qg== +X-Received: by 10.180.84.226 with SMTP id c2mr15085697wiz.50.1400746016438; + Thu, 22 May 2014 01:06:56 -0700 (PDT) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by mx.google.com with ESMTPSA id iy13sm6616144wic.1.2014.05.22.01.06.55 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Thu, 22 May 2014 01:06:55 -0700 (PDT) +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: <87bnv92521.fsf@inf-8660.int-evry.fr> +References: <87oazb9k5f.fsf@inf-8660.int-evry.fr> <87mweuzy87.fsf@qmul.ac.uk> + <87bnv92521.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: Thu, 22 May 2014 09:06:54 +0100 +Message-ID: <87wqde6xup.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +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: Thu, 22 May 2014 08:07:04 -0000 + +On Wed, 07 May 2014, Olivier Berger wrote: +> Hi. +> +> Mark Walters writes: +> +>> 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). +>> +> +> Thanks. This works exactly I like it :-) +> +>>> 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! +>> +> +> Note that I'm now using the following : +> (define-key notmuch-search-mode-map "S" +> (lambda (&optional beg end) +> "mark messages in thread as spam" +> (interactive (notmuch-search-interactive-region)) +> (notmuch-search-tag '("+spam" "-inbox") beg end) +> (if (eq beg end) (notmuch-search-next-thread)))) +> +> This offers the possibility to jump to the next line when tagging +> individual lines, and not do so when acting on a region. +> +> Btw, such a difference in behaviour may be a tiny, but still nice +> improvement on the code of notmuch-search-archive-thread too. + +I think this is worth doing: do you want to send a patch? The above lisp +is fine but I would replace the "if" by "when". (The main difference is +that "when" cannot take an else clause so using when flags up that there +is not an else clause.) + +If the above is inconvenient then I am happy to post such a patch. + +Best wishes + +Mark + + +> +> I haven't touched the wiki, as I'm not sure this is the best way to +> write it and everyone would be interested. +> +> Hope this helps. +> +> Best regards, +> +> -- +> Olivier BERGER +> http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8 +> Ingenieur Recherche - Dept INF +> Institut Mines-Telecom, Telecom SudParis, Evry (France) +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch