--- /dev/null
+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 EAD56431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 19 Dec 2012 15:10:16 -0800 (PST)\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 HGUVbRNsF0yH for <notmuch@notmuchmail.org>;\r
+ Wed, 19 Dec 2012 15:10:16 -0800 (PST)\r
+Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com\r
+ [74.125.82.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 5908D431FAE for <notmuch@notmuchmail.org>; Wed, 19 Dec 2012 15:10:16 -0800\r
+ (PST)\r
+Received: by mail-wg0-f52.google.com with SMTP id 12so1201746wgh.31\r
+ for <notmuch@notmuchmail.org>; Wed, 19 Dec 2012 15:10:15 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=x-received:from:to:cc:subject:date:message-id:x-mailer;\r
+ bh=L8xG0c+kyR2Q4x4KIUN6/ACvOugozyUScsrwUcmvqRs=;\r
+ b=wUBgYPLqzBNBDDI4svJbTLRKmp6I4MfrPWlUWlW/5QKk2Rz61+sWZTtJp8T5JKLT64\r
+ u51qoWUDVBARADkmsHjf6tjBVSWXjHyLvisYkwO0is3/9OqtF7X3DMfBddSLptlucjLv\r
+ TQS463qm5l+NxAsupAudwt1JvHPlHPy0cP/+cOcRyKIGFHDDPQyOXTBbTSzpa8NtNNOO\r
+ vrSdLUVCxJh5aS2IkLiGe28UTpEBWtni9I2CeO/spWVK2kDmTanQJbYYzR5CpUZycrQh\r
+ YLQexKPaJlP1P/09HQggY2qd0tEvgaT0NC60Aw7lLO2oAXE4Q3sMD4uMJNHoF1ggHnix\r
+ EtIw==\r
+X-Received: by 10.180.78.226 with SMTP id e2mr12356636wix.1.1355958613855;\r
+ Wed, 19 Dec 2012 15:10:13 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPS id i2sm22694607wiw.3.2012.12.19.15.10.11\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Wed, 19 Dec 2012 15:10:12 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: show: make id links respect window\r
+Date: Wed, 19 Dec 2012 23:10:02 +0000\r
+Message-Id: <1355958602-16752-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\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: Wed, 19 Dec 2012 23:10:17 -0000\r
+\r
+There is a bug in current notmuch: if you have multiple windows in one\r
+frame and click an id button link in a show buffer that does not\r
+contain point then the link is opened in the window containing point.\r
+\r
+This reads the mouse event to make sure that the correct window is\r
+used for the link.\r
+---\r
+\r
+I think this is a bug but that could be debated. It is particularly\r
+easy to trigger with notmuch pick because that uses the split pane\r
+while focus usually remains in the `pick' pane rather than the `show'\r
+pane.\r
+\r
+The lisp is not pretty but seems to work.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\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..5664ea3 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
++ (select-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