From: Austin Clements Date: Mon, 7 Jan 2013 07:04:14 +0000 (+1900) Subject: Re: [PATCH] emacs: show: make id links respect window X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=7dabad7b888f4bcd100927c08db747a156fdc72b;p=notmuch-archives.git Re: [PATCH] emacs: show: make id links respect window --- diff --git a/aa/e1d3b04a72851aaa5bbe3492356788d2deeb83 b/aa/e1d3b04a72851aaa5bbe3492356788d2deeb83 new file mode 100644 index 000000000..44761085a --- /dev/null +++ b/aa/e1d3b04a72851aaa5bbe3492356788d2deeb83 @@ -0,0 +1,139 @@ +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 C29FD431FAF + for ; Sun, 6 Jan 2013 23:04:21 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 imAXnic6kmpw for ; + Sun, 6 Jan 2013 23:04:19 -0800 (PST) +Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU + [18.9.25.12]) + by olra.theworths.org (Postfix) with ESMTP id AF7EE431FAE + for ; Sun, 6 Jan 2013 23:04:19 -0800 (PST) +X-AuditID: 1209190c-b7fa86d000001d37-34-50ea737249a6 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP + id E2.53.07479.2737AE05; Mon, 7 Jan 2013 02:04:18 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r0774H4Z026496; + Mon, 7 Jan 2013 02:04:18 -0500 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id r0774FCc016660 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Mon, 7 Jan 2013 02:04:16 -0500 (EST) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1Ts6kp-0005KJ-2y; Mon, 07 Jan 2013 02:04:15 -0500 +From: Austin Clements +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: show: make id links respect window +In-Reply-To: <1355958602-16752-1-git-send-email-markwalters1009@gmail.com> +References: <1355958602-16752-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Notmuch/0.14+236~gf64406d (http://notmuchmail.org) Emacs/23.4.1 + (i486-pc-linux-gnu) +Date: Mon, 07 Jan 2013 02:04:14 -0500 +Message-ID: <87vcb9jwy9.fsf@awakening.csail.mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFnrDIsWRmVeSWpSXmKPExsUixCmqrFtU/CrAYNFmQYvVc3ksrt+cyezA + 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZXxacZ2loEGw4vqDP+wNjPN5uxg5OSQETCRe + rvzPDGGLSVy4t56ti5GLQ0hgH6PEiWUHmCGc9YwSv85+Z4JwLjBJzH4+lx3CWcIo8fL1FbB+ + NgENiW37lzOC2CICrhJPv30GiwsL2Enca53ABmJzCnhJdN1bydrFyAHU7Cnx6rsMSFhUIF7i + +b1vLCA2i4CqxOnuh2DlvEDnPWvYwAphC0qcnPkErIZZQEvixr+XTBMYBWYhSc1CklrAyLSK + UTYlt0o3NzEzpzg1Wbc4OTEvL7VI11AvN7NELzWldBMjOCAleXYwvjmodIhRgINRiYf3gsGr + ACHWxLLiytxDjJIcTEqivMcKgUJ8SfkplRmJxRnxRaU5qcWHGCU4mJVEeHnsgXK8KYmVValF + +TApaQ4WJXHeyyk3/YUE0hNLUrNTUwtSi2CyMhwcShK8e4uAGgWLUtNTK9Iyc0oQ0kwcnCDD + eYCGvwGp4S0uSMwtzkyHyJ9i1OVoeHnjKaMQS15+XqqUOO8ekCIBkKKM0jy4ObBE8opRHOgt + YV5TkCoeYBKCm/QKaAkT0JLUx89BlpQkIqSkGhiD7tYKzGr9/1Gf9+Tpf0FvyuaYT7sh+ddV + 52rmxYiFUnpSl17mv64ROxVvOaPAJNQhtm9DwJUexbgdi4pud3/RFuhhPRF4UC/4dq2AzMuv + 92d9UU2bVBKSdnNlxw5xo+3+1rapbW8Or2XteL/Cc8WDfP04vlDLJyIvGheuEfo71yv/70aX + 1BlKLMUZiYZazEXFiQAYp0Yu/wIAAA== +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: Mon, 07 Jan 2013 07:04:21 -0000 + +On Wed, 19 Dec 2012, Mark Walters wrote: +> There is a bug in current notmuch: if you have multiple windows in one +> frame and click an id button link in a show buffer that does not +> contain point then the link is opened in the window containing point. +> +> This reads the mouse event to make sure that the correct window is +> used for the link. + +Personally I prefer that point move to the clicked window, as this patch +does. The fact that it's even possible for point not to move to the +clicked window I find strange. + +> --- +> +> I think this is a bug but that could be debated. It is particularly +> easy to trigger with notmuch pick because that uses the split pane +> while focus usually remains in the `pick' pane rather than the `show' +> pane. +> +> The lisp is not pretty but seems to work. +> +> Best wishes +> +> Mark +> +> +> +> +> emacs/notmuch-show.el | 5 +++++ +> 1 files changed, 5 insertions(+), 0 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 5751d98..5664ea3 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1077,6 +1077,11 @@ buttons for a corresponding notmuch search." +> (make-text-button (first link) (second link) +> 'action `(lambda (arg) +> (notmuch-show ,(third link))) +> + 'mouse-action `(lambda (arg) +> + (let* ((event last-input-event) +> + (window (car (cadr event)))) + +Better would be (posn-window (event-start event)). If you use the +accessors, I don't think the let bindings are really necessary since the +code becomes self-documenting. + +> + (select-window window) +> + (notmuch-show ,(third link)))) + +Would it be better to (button-activate arg) so you don't have to +duplicate the action code? (Then you also wouldn't need the +quasiquoting and unquoting.) + +> 'follow-link t +> 'help-echo "Mouse-1, RET: search for this message" +> 'face goto-address-mail-face))))) +> -- +> 1.7.9.1 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch