Re: [PATCH] emacs: show: make id links respect window
authorMark Walters <markwalters1009@gmail.com>
Sun, 6 Jan 2013 15:43:35 +0000 (15:43 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:52:57 +0000 (09:52 -0800)
dc/8a1259c7bef21d567f4fa043f12e396f3e07ce [new file with mode: 0644]

diff --git a/dc/8a1259c7bef21d567f4fa043f12e396f3e07ce b/dc/8a1259c7bef21d567f4fa043f12e396f3e07ce
new file mode 100644 (file)
index 0000000..e0dc74b
--- /dev/null
@@ -0,0 +1,146 @@
+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 AC07B431FAF\r
+       for <notmuch@notmuchmail.org>; Sun,  6 Jan 2013 07:43:41 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+       tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+       NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 hGEIwkuMZLTk for <notmuch@notmuchmail.org>;\r
+       Sun,  6 Jan 2013 07:43:40 -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 2130D431FAE\r
+       for <notmuch@notmuchmail.org>; Sun,  6 Jan 2013 07:43:40 -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 1TrsNo-0001Ae-Jk; Sun, 06 Jan 2013 15:43:33 +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 1TrsNo-0005zL-9d; Sun, 06 Jan 2013 15:43:32 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, David Bremner <david@tethera.net>,\r
+       notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: show: make id links respect window\r
+In-Reply-To: <m2zk0ni9jg.fsf@guru.guru-group.fi>\r
+References: <1355958602-16752-1-git-send-email-markwalters1009@gmail.com>\r
+       <87bodjfnt0.fsf@zancas.localnet> <87mwx2jsu0.fsf@qmul.ac.uk>\r
+       <87bodgrh6a.fsf@zancas.localnet>\r
+       <m2zk0ni9jg.fsf@guru.guru-group.fi>\r
+User-Agent: Notmuch/0.14+236~g1d0044f (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sun, 06 Jan 2013 15:43:35 +0000\r
+Message-ID: <87k3rqz594.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: 98603f3e42f2273d9f40b14ec3035a33 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -1.8\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.8 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
+       *  0.5 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: Sun, 06 Jan 2013 15:43:41 -0000\r
+\r
+\r
+On Sat, 05 Jan 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> On Wed, Dec 26 2012, David Bremner <david@tethera.net> wrote:\r
+>\r
+>> Mark Walters <markwalters1009@gmail.com> writes:\r
+>>\r
+>>>> I can imagine that people would want/like the "open in other window" \r
+>>>> effect of the current code, even if the reason is a bug.\r
+>>>\r
+>>> That's definitely possible. I generally expect a mouse click to select\r
+>>> the window I click and this feels counter intuitive. I think that some\r
+>>> people might like an option "open this link in a new window" but I would\r
+>>> guess that would like that whether they clicked or pressed RET on the\r
+>>> button.\r
+>>\r
+>> I don't care much either way myself, but before we change notmuch-show\r
+>> behaviour (effectively) to accomodate notmuch-pick, I'd like a bit more\r
+>> feedback from other people.\r
+>\r
+> I tested the old behaviour -- split frame to 2 windows, one containing\r
+> *scratch* and one *notmuch-hello*. Then I searched for 'obsoletes',\r
+> chose last message (id:1356936162-2589-1-git-send-email-amdragon@mit.edu)\r
+> moved point to *scratch* buffer and clicked the id: link -- and indeed,\r
+> the *scratch* window was replaced.\r
+>\r
+> I didn't look or test Mark's patch as he stated:\r
+> "The lisp is not pretty but seems to work." ;)\r
+> ... well, not entirely because of that but I trust it opens the message\r
+> in window where the clicked link were and keeps point where it used to\r
+> be before clicking (in case point was in different window).\r
+\r
+It doesn't quite do this: point moves to the window that was clicked. It\r
+is just as easy to do as Tomi says (patch below but I should resend if\r
+people like it so the commit message gets picked up).\r
+\r
+Incidentally, I would be interested to know what people expect the\r
+following to do: go to notmuch hello and then search. Now display the\r
+results in two windows simultaneously (either split the frame into two\r
+windows (c-x 2) or use 2 frames (C-x 5 2)) and then press q.\r
+\r
+What actually happens is that q runs kill buffer so it disappears in\r
+both windows: one of which will fall back to notmuch-hello and one of\r
+which will fall back to some other window (eg scratch)\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+ emacs/notmuch-show.el |    5 +++++\r
+ 1 files changed, 5 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 5751d98..00b9b56 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1077,6 +1077,11 @@ buttons for a corresponding notmuch search."\r
+       (make-text-button (first link) (second link)\r
+                         'action `(lambda (arg)\r
+                                    (notmuch-show ,(third link)))\r
++                        'mouse-action `(lambda (arg)\r
++                                         (let* ((event last-input-event)\r
++                                                (window (car (cadr event))))\r
++                                           (with-selected-window window\r
++                                             (notmuch-show ,(third link)))))\r
+                         'follow-link t\r
+                         'help-echo "Mouse-1, RET: search for this message"\r
+                         'face goto-address-mail-face)))))\r
+-- \r
+1.7.9.1\r
+\r