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 738DC431FAF for ; Mon, 7 Jan 2013 12:22:27 -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 vmUDB5Uyh-qp for ; Mon, 7 Jan 2013 12:22:26 -0800 (PST) Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id AA597431FAE for ; Mon, 7 Jan 2013 12:22:26 -0800 (PST) X-AuditID: 1209190d-b7efd6d000001a82-c1-50eb2e802e12 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id E8.F8.06786.08E2BE05; Mon, 7 Jan 2013 15:22:24 -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 r07KMNN8021436; Mon, 7 Jan 2013 15:22:24 -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 r07KMLKV020117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 7 Jan 2013 15:22:23 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1TsJDB-0000hY-N1; Mon, 07 Jan 2013 15:22:21 -0500 Date: Mon, 7 Jan 2013 15:22:21 -0500 From: Austin Clements To: Mark Walters Subject: Re: [PATCH] emacs: show: make buttons select window Message-ID: <20130107202221.GL17581@mit.edu> References: <1357583091-28738-1-git-send-email-markwalters1009@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1357583091-28738-1-git-send-email-markwalters1009@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IR4hRV1m3Qex1gsHeTtMXquTwW12/OZHZg 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mjb+mMhasEG9YvUphQbGh/JdjJwcEgImEo13 3jBD2GISF+6tZ+ti5OIQEtjHKLHvwmQWCGc9o8TZE3PZQKqEBC4wSax4zQqRWMIoMf3zcrB2 FgEVib6zsxhBbDYBDYlt+5eD2SICOhK3Dy1gB7GZBaQlvv1uZgKxhQVsJL6v/wBm8wLVTLi1 iB1igafElMPPoOKCEidnPmGB6NWSuPHvJVCcA2zO8n8cIGFOAS+J9V/Pga0SBTphysltbBMY hWYh6Z6FpHsWQvcCRuZVjLIpuVW6uYmZOcWpybrFyYl5ealFukZ6uZkleqkppZsYwSEtybuD 8d1BpUOMAhyMSjy8L11fBQixJpYVV+YeYpTkYFIS5X0s9zpAiC8pP6UyI7E4I76oNCe1+BCj BAezkgjvtwdA5bwpiZVVqUX5MClpDhYlcd4rKTf9hQTSE0tSs1NTC1KLYLIyHBxKErzlukBD BYtS01Mr0jJzShDSTBycIMN5gIbng9TwFhck5hZnpkPkTzEqSonzxoEkBEASGaV5cL2wlPOK URzoFWHeWpAqHmC6gut+BTSYCWhw6uPnIINLEhFSUg2MDk/r9EW9T07cGbj5jJLvQ/EgzaRH L2csUpn3VuHLi8qPx46yTzmyeKX3EieDvS9dn8x6v8+bk6FY9UrA+lL+ubdPcCxk/Hrsjo7f sdvLQ1ujMjecfq5h+urzL4ktgd8kcw/+Pb3Bt7RZ7GKugNOX82bqfVu+O+ustW7yeT5RxGel Or/8cgnvz0osxRmJhlrMRcWJAEr93ggUAwAA Cc: notmuch@notmuchmail.org 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 20:22:27 -0000 Quoth Mark Walters on Jan 07 at 6:24 pm: > Emacs has two button type objects: widgets (as used for saved searches > in notmuch-hello) and buttons as used by parts/citations and id links > in notmuch-show. These two behave subtly differently when clicked with > the mouse: widgets select the window clicked before running the > action, buttons do not. > > This patch makes all of these behave the same: clicking always selects > the clicked window. It does this by defining a notmuch-button-type > supertype that the other notmuch buttons can inherit from. This > supertype binds the mouse-action to select the window and then > activate the button. > --- > > This is a new patch attempting to do the same as > id:1355958602-16752-1-git-send-email-markwalters1009@gmail.com > > This version changes all notmuch buttons to select the appropriate > window before applying the action. This brings the buttons in line > with widgets (as used in notmuch hello) and whatever is used for > http:// links. > > I think that buttons should at least run the action in the clicked > window: whether point should remain there is less clear. This version > does leave point there as this is what widgets and links do (but this > would be easy to change). > > I don't know whether we want to do this for 0.15: the change for id > links would be nice, the other cases are less important. If preferred > I can provide a patch fixing that single instance. > > Finally, if anyone who uses the crypto stuff could check that it works > for crypto buttons that would be nice as I do not have crypto setup. > > Best wishes > > Mark > > > > > emacs/notmuch-crypto.el | 3 ++- > emacs/notmuch-lib.el | 5 +++++ > emacs/notmuch-show.el | 4 +++- > emacs/notmuch-wash.el | 3 ++- > 4 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el > index 83e5d37..173a3e7 100644 > --- a/emacs/notmuch-crypto.el > +++ b/emacs/notmuch-crypto.el > @@ -76,7 +76,8 @@ mode." > (define-button-type 'notmuch-crypto-status-button-type > 'action (lambda (button) (message (button-get button 'help-echo))) > 'follow-link t > - 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.") > + 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts." > + :supertype 'notmuch-button-type) This should be 'supertype for consistency. Also, notmuch-crypto.el should have a (require 'notmuch-lib) at the top now. > > (defun notmuch-crypto-insert-sigstatus-button (sigstatus from) > (let* ((status (plist-get sigstatus :status)) > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el > index 0407f8a..1573e32 100644 > --- a/emacs/notmuch-lib.el > +++ b/emacs/notmuch-lib.el > @@ -97,6 +97,11 @@ For example, if you wanted to remove an \"inbox\" tag and add an > :group 'notmuch-search > :group 'notmuch-show) > > +(define-button-type 'notmuch-button-type > + 'mouse-action (lambda (button) > + (select-window (posn-window (event-start last-input-event))) > + (button-activate button))) > + I think this deserves a comment explaining how buttons behave by default and the problems this causes both for code (funny results of buffer changes and point placement) and user experience (not moving point to the clicked window). > (defun notmuch-version () > "Return a string with the notmuch version number." > (let ((long-string > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 5751d98..059194d 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -469,7 +469,8 @@ message at DEPTH in the current thread." > 'action 'notmuch-show-part-button-default > 'keymap 'notmuch-show-part-button-map > 'follow-link t > - 'face 'message-mml) > + 'face 'message-mml > + :supertype 'notmuch-button-type) 'supertype > > (defvar notmuch-show-part-button-map > (let ((map (make-sparse-keymap))) > @@ -1075,6 +1076,7 @@ buttons for a corresponding notmuch search." > ;; Remove the overlay created by goto-address-mode > (remove-overlays (first link) (second link) 'goto-address t) > (make-text-button (first link) (second link) > + :type 'notmuch-button-type 'type > 'action `(lambda (arg) > (notmuch-show ,(third link))) > 'follow-link t > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el > index d6db4fa..826b6f4 100644 > --- a/emacs/notmuch-wash.el > +++ b/emacs/notmuch-wash.el > @@ -115,7 +115,8 @@ lower).") > (define-button-type 'notmuch-wash-button-invisibility-toggle-type > 'action 'notmuch-wash-toggle-invisible-action > 'follow-link t > - 'face 'font-lock-comment-face) > + 'face 'font-lock-comment-face > + :supertype 'notmuch-button-type) 'supertype > > (define-button-type 'notmuch-wash-button-citation-toggle-type > 'help-echo "mouse-1, RET: Show citation"