1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 28F2E431FAF
\r
6 for <notmuch@notmuchmail.org>; Mon, 7 Jan 2013 13:20:19 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id L1q3r1sDa6+T for <notmuch@notmuchmail.org>;
\r
16 Mon, 7 Jan 2013 13:20:18 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 4524C431FAE
\r
20 for <notmuch@notmuchmail.org>; Mon, 7 Jan 2013 13:20:18 -0800 (PST)
\r
21 X-AuditID: 1209190c-b7fa86d000001d37-9e-50eb3c111241
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 81.8E.07479.11C3BE05; Mon, 7 Jan 2013 16:20:17 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r07LKAZK029031;
\r
27 Mon, 7 Jan 2013 16:20:11 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id r07LK8PD003845
\r
32 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
33 Mon, 7 Jan 2013 16:20:09 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1TsK76-00010G-Go; Mon, 07 Jan 2013 16:20:08 -0500
\r
37 Date: Mon, 7 Jan 2013 16:20:08 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Mark Walters <markwalters1009@gmail.com>
\r
40 Subject: Re: [PATCH v2] emacs: show: make buttons select window
\r
41 Message-ID: <20130107212008.GM17581@mit.edu>
\r
42 References: <20130107202221.GL17581@mit.edu>
\r
43 <1357592840-31155-1-git-send-email-markwalters1009@gmail.com>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 Content-Disposition: inline
\r
47 In-Reply-To: <1357592840-31155-1-git-send-email-markwalters1009@gmail.com>
\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
49 X-Brightmail-Tracker:
\r
50 H4sIAAAAAAAAA+NgFvrHIsWRmVeSWpSXmKPExsUixCmqrSto8zrA4PgjA4vVc3ksrt+cyezA
\r
51 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZTTuWMFUsEa14tGh3UwNjHPkuhg5OSQETCR2
\r
52 Xm1mgbDFJC7cW88GYgsJ7GOUODzHG8Jezyjx5JUNhH2BSeLZFYUuRi4gewmjxK6lPawgCRYB
\r
53 FYlNv68ygdhsAhoS2/YvZwSxRQR0JG4fWsAOYjMLSEt8+90MVMPBISxgL/H2gy5ImBeoZOf6
\r
54 2+wgYSGBHInVDyogwoISJ2c+YYHo1JK48e8lWCfIlOX/OEDCnAJeEjMuHgK7WBTogCknt7FN
\r
55 YBSahaR7FpLuWQjdCxiZVzHKpuRW6eYmZuYUpybrFicn5uWlFuka6uVmluilppRuYgQHsyTP
\r
56 DsY3B5UOMQpwMCrx8F4weBUgxJpYVlyZe4hRkoNJSZR3leXrACG+pPyUyozE4oz4otKc1OJD
\r
57 jBIczEoivN8eAJXzpiRWVqUW5cOkpDlYlMR5L6fc9BcSSE8sSc1OTS1ILYLJynBwKEnwRloD
\r
58 DRUsSk1PrUjLzClBSDNxcIIM5wEa3glSw1tckJhbnJkOkT/FqCglztsLkhAASWSU5sH1wpLN
\r
59 K0ZxoFeEeTNAqniAiQqu+xXQYCagwamPn4MMLklESEk1MHpksziKTV813WV1wE7XH2wscdxf
\r
60 vjvdTD5oI7sqWCX4MN9fv1T5j0LdL030Z8Ut49NcKb7JZuut14vbpX4dPblCNDp0u37cEqci
\r
61 1oOL25vecOuWl9Rvdfx/cpm1v3LM7JyGpv0n1G/Kvtm35danjsbakEmHZvb8bMjV8dow6db/
\r
62 KfPmySkW9CqxFGckGmoxFxUnAgB4DGOWEQMAAA==
\r
63 Cc: notmuch@notmuchmail.org
\r
64 X-BeenThere: notmuch@notmuchmail.org
\r
65 X-Mailman-Version: 2.1.13
\r
67 List-Id: "Use and development of the notmuch mail system."
\r
68 <notmuch.notmuchmail.org>
\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
72 List-Post: <mailto:notmuch@notmuchmail.org>
\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
76 X-List-Received-Date: Mon, 07 Jan 2013 21:20:19 -0000
\r
80 Quoth Mark Walters on Jan 07 at 9:07 pm:
\r
81 > Emacs has two button type objects: widgets (as used for saved searches
\r
82 > in notmuch-hello) and buttons as used by parts/citations and id links
\r
83 > in notmuch-show. These two behave subtly differently when clicked with
\r
84 > the mouse: widgets select the window clicked before running the
\r
85 > action, buttons do not.
\r
87 > This patch makes all of these behave the same: clicking always selects
\r
88 > the clicked window. It does this by defining a notmuch-button-type
\r
89 > supertype that the other notmuch buttons can inherit from. This
\r
90 > supertype binds the mouse-action to select the window and then
\r
91 > activate the button.
\r
94 > This versions fixes most of the comments raised by Austin's review.
\r
95 > The one change I didn't make was changing :supertype to 'supertype. In
\r
96 > principle I agree with Austin but the : form is used for inheritance
\r
97 > for other notmuch buttons in wash and crypto.
\r
106 > emacs/notmuch-crypto.el | 5 ++++-
\r
107 > emacs/notmuch-lib.el | 15 +++++++++++++++
\r
108 > emacs/notmuch-show.el | 4 +++-
\r
109 > emacs/notmuch-wash.el | 3 ++-
\r
110 > 4 files changed, 24 insertions(+), 3 deletions(-)
\r
112 > diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
\r
113 > index 83e5d37..5233824 100644
\r
114 > --- a/emacs/notmuch-crypto.el
\r
115 > +++ b/emacs/notmuch-crypto.el
\r
116 > @@ -19,6 +19,8 @@
\r
118 > ;; Authors: Jameson Rollins <jrollins@finestructure.net>
\r
120 > +(require 'notmuch-lib)
\r
122 > (defcustom notmuch-crypto-process-mime nil
\r
123 > "Should cryptographic MIME parts be processed?
\r
125 > @@ -76,7 +78,8 @@ mode."
\r
126 > (define-button-type 'notmuch-crypto-status-button-type
\r
127 > 'action (lambda (button) (message (button-get button 'help-echo)))
\r
129 > - 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")
\r
130 > + 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts."
\r
131 > + :supertype 'notmuch-button-type)
\r
133 > (defun notmuch-crypto-insert-sigstatus-button (sigstatus from)
\r
134 > (let* ((status (plist-get sigstatus :status))
\r
135 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
136 > index 0407f8a..6836192 100644
\r
137 > --- a/emacs/notmuch-lib.el
\r
138 > +++ b/emacs/notmuch-lib.el
\r
139 > @@ -97,6 +97,21 @@ For example, if you wanted to remove an \"inbox\" tag and add an
\r
140 > :group 'notmuch-search
\r
141 > :group 'notmuch-show)
\r
143 > +;; By default clicking on a button does not select the window
\r
144 > +;; containing the button (as opposed to clicking on a widget which
\r
145 > +;; does). This means that the button action is then executed in the
\r
146 > +;; current selected window which can cause problems if the button
\r
147 > +;; changes the buffer (e.g., id: links) or moves point.
\r
149 > +;; This provides a button type which overrides mouse-action so that
\r
150 > +;; the button's window is selected before the action is run. Other
\r
151 > +;; notmuch buttons can get the same behaviour by inheriting from this
\r
153 > +(define-button-type 'notmuch-button-type
\r
154 > + 'mouse-action (lambda (button)
\r
155 > + (select-window (posn-window (event-start last-input-event)))
\r
156 > + (button-activate button)))
\r
158 > (defun notmuch-version ()
\r
159 > "Return a string with the notmuch version number."
\r
160 > (let ((long-string
\r
161 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
162 > index 5751d98..059194d 100644
\r
163 > --- a/emacs/notmuch-show.el
\r
164 > +++ b/emacs/notmuch-show.el
\r
165 > @@ -469,7 +469,8 @@ message at DEPTH in the current thread."
\r
166 > 'action 'notmuch-show-part-button-default
\r
167 > 'keymap 'notmuch-show-part-button-map
\r
169 > - 'face 'message-mml)
\r
170 > + 'face 'message-mml
\r
171 > + :supertype 'notmuch-button-type)
\r
173 > (defvar notmuch-show-part-button-map
\r
174 > (let ((map (make-sparse-keymap)))
\r
175 > @@ -1075,6 +1076,7 @@ buttons for a corresponding notmuch search."
\r
176 > ;; Remove the overlay created by goto-address-mode
\r
177 > (remove-overlays (first link) (second link) 'goto-address t)
\r
178 > (make-text-button (first link) (second link)
\r
179 > + :type 'notmuch-button-type
\r
180 > 'action `(lambda (arg)
\r
181 > (notmuch-show ,(third link)))
\r
183 > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
\r
184 > index d6db4fa..826b6f4 100644
\r
185 > --- a/emacs/notmuch-wash.el
\r
186 > +++ b/emacs/notmuch-wash.el
\r
187 > @@ -115,7 +115,8 @@ lower).")
\r
188 > (define-button-type 'notmuch-wash-button-invisibility-toggle-type
\r
189 > 'action 'notmuch-wash-toggle-invisible-action
\r
191 > - 'face 'font-lock-comment-face)
\r
192 > + 'face 'font-lock-comment-face
\r
193 > + :supertype 'notmuch-button-type)
\r
195 > (define-button-type 'notmuch-wash-button-citation-toggle-type
\r
196 > 'help-echo "mouse-1, RET: Show citation"
\r