Re: [PATCH 0/3] Add notmuch-pick to contrib
authorMark Walters <markwalters1009@gmail.com>
Sat, 1 Dec 2012 21:03:06 +0000 (21:03 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:17 +0000 (09:51 -0800)
0a/6e0284a658af45fcfeb2c01c03e572d447af4d [new file with mode: 0644]

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