From bb7c3fdd214e5681286dcea861f6cabf820c85d9 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 1 Dec 2012 21:03:06 +0000 Subject: [PATCH] Re: [PATCH 0/3] Add notmuch-pick to contrib --- 0a/6e0284a658af45fcfeb2c01c03e572d447af4d | 174 ++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 0a/6e0284a658af45fcfeb2c01c03e572d447af4d diff --git a/0a/6e0284a658af45fcfeb2c01c03e572d447af4d b/0a/6e0284a658af45fcfeb2c01c03e572d447af4d new file mode 100644 index 000000000..71c421707 --- /dev/null +++ b/0a/6e0284a658af45fcfeb2c01c03e572d447af4d @@ -0,0 +1,174 @@ +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 C4C7F431FBC + for ; Sat, 1 Dec 2012 13:03:15 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 1.401 +X-Spam-Level: * +X-Spam-Status: No, score=1.401 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + FREEMAIL_REPLY=2.499, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] + 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 hCUQpTpNjIKR for ; + Sat, 1 Dec 2012 13:03:11 -0800 (PST) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B0B5B431FAF + for ; Sat, 1 Dec 2012 13:03:11 -0800 (PST) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1TeuDL-0000LX-Ku; Sat, 01 Dec 2012 21:03:07 +0000 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1TeuDL-0000a3-5g; Sat, 01 Dec 2012 21:03:07 +0000 +From: Mark Walters +To: David Bremner , notmuch@notmuchmail.org +Subject: Re: [PATCH 0/3] Add notmuch-pick to contrib +In-Reply-To: <87390ywrru.fsf@zancas.localnet> +References: <1351337200-18050-1-git-send-email-markwalters1009@gmail.com> + <87390ywrru.fsf@zancas.localnet> +User-Agent: Notmuch/0.14+81~g9730584 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sat, 01 Dec 2012 21:03:06 +0000 +Message-ID: <874nk5cwol.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 0cab756348e7099fe533a9eea46ce948 (of first 20000 bytes) +X-SpamAssassin-Score: -1.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 -1.1 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 1.0 FREEMAIL_REPLY From and body contain different freemails + * 0.2 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: Sat, 01 Dec 2012 21:03:16 -0000 + + +Hi + +On Sun, 28 Oct 2012, David Bremner wrote: +> Mark Walters writes: +> +>> This is a new version of notmuch-pick (previous version at +>> id:"1343164911-31589-1-git-send-email-markwalters1009@gmail.com")following +>> suggestions of Tomi and David in that thread. The main change is that +>> it is now entirely self contained in contrib: all the user needs to do +>> is copy the notmuch-pick.el somewhere in the emacs load path and add +>> (require 'notmuch-pick nil t) to their .emacs file. +> +> I have pushed this to contrib. +> +> We do need tests before this goes mainline. What about (untested) having +> the tests in contrib/notmuch-pick for now, including as needed from +> ../../test. +> +> We should mention it in NEWS; at this point I think it is reasonable to +> expect to do at least one release with pick in contrib. +> +> As a vague feature request, what about forwarding unknown keys to +> the notmuch-show buffer? + +Here is an implementation of forwarding unknown keys to the show +buffer. The main pass-through part is based on an idea of David's on +irc. + +The implementation is not perfect but might be sufficiently good +to be worth adding. + +I can't easily see how to decide if a key is unknown because that isn't +really the right question: almost all keys are bound by the global emacs +keymap and some of those bindings we want to use (eg like for +next line). Keys like "t" etc are also bound to "insert t" but those +flag an error as the buffer is readonly. It might be possible to hook +into things from that "error" but I couldn't see how to make it work. + +Instead this works the other way round: it takes the notmuch-show +keymap, pulls them all into the pick keymap (with a wrapper so the +action takes place in the message-pane), and then adds the pick +keybindings (so they overwrite show-mode ones when the overlap). + +One question is what to do with the fall through if the pick-message +pane is not open: I have opted for opening the pane with the current +message, running the appropriate show command, and closing the current +pane. This means that things like "view all attachments (v)" or "stash +message id (c i)" work regardless of whether the message pane is open. + +Anyway what does anyone think? + +Oh one last thing: it does somewhat mess up the "help" for notmuch pick. + +Best wishes + +Mark + + +--- + contrib/notmuch-pick/notmuch-pick.el | 16 ++++++++++++++++ + 1 files changed, 16 insertions(+), 0 deletions(-) + +diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el +index 755cbbc..cded5a1 100644 +--- a/contrib/notmuch-pick/notmuch-pick.el ++++ b/contrib/notmuch-pick/notmuch-pick.el +@@ -166,9 +166,25 @@ + (defvar notmuch-pick-process-state nil + "Parsing state of the search process filter.") + ++(defun notmuch-pick-message-buffer-command () ++ "Pass key through to show pane" ++ (interactive) ++ (let ((command (lookup-key notmuch-show-mode-map (this-command-keys))) ++ (split-pane (window-live-p notmuch-pick-message-window))) ++ (unless split-pane ++ (notmuch-pick-show-message)) ++ (with-current-buffer notmuch-pick-message-buffer ++ (funcall command)) ++ (unless split-pane ++ (notmuch-pick-close-message-window)))) + + (defvar notmuch-pick-mode-map + (let ((map (make-sparse-keymap))) ++ ;; This has to come first so it gets overwritten by pick's own ++ ;; commands. ++ (loop for seq being the key-seqs of notmuch-show-mode-map ++ do ++ (define-key map seq 'notmuch-pick-message-buffer-command)) + (define-key map [mouse-1] 'notmuch-pick-show-message) + (define-key map "q" 'notmuch-pick-quit) + (define-key map "x" 'notmuch-pick-quit) +-- +1.7.9.1 + + + + -- 2.26.2