From dc6a1629a1e063eb93c447fb323aa18e296d9454 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 8 Jan 2013 15:39:49 +1900 Subject: [PATCH] [PATCH] emacs: Disambiguate point placement after hiding message --- 11/da24c1a10bb7c842b8352667adf65776e816c2 | 117 ++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 11/da24c1a10bb7c842b8352667adf65776e816c2 diff --git a/11/da24c1a10bb7c842b8352667adf65776e816c2 b/11/da24c1a10bb7c842b8352667adf65776e816c2 new file mode 100644 index 000000000..032f5fba6 --- /dev/null +++ b/11/da24c1a10bb7c842b8352667adf65776e816c2 @@ -0,0 +1,117 @@ +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 2BF3A431FAF + for ; Mon, 7 Jan 2013 12:40:04 -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 S-qa0NPACIGN for ; + Mon, 7 Jan 2013 12:40:03 -0800 (PST) +Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU + [18.7.68.36]) + by olra.theworths.org (Postfix) with ESMTP id 9FA02431FAE + for ; Mon, 7 Jan 2013 12:40:03 -0800 (PST) +X-AuditID: 12074424-b7f4e6d0000004ca-af-50eb32a31b6a +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP + id 47.3D.01226.3A23BE05; Mon, 7 Jan 2013 15:40:03 -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 r07Ke2Kk024182; + Mon, 7 Jan 2013 15:40:02 -0500 +Received: from drake.dyndns.org (a069.catapulsion.net [70.36.81.69]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id r07KdxmR024552 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Mon, 7 Jan 2013 15:40:01 -0500 (EST) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1TsJUE-00055K-Kq; Mon, 07 Jan 2013 15:39:58 -0500 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: Disambiguate point placement after hiding message +Date: Mon, 7 Jan 2013 15:39:49 -0500 +Message-Id: <1357591189-19487-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFprNIsWRmVeSWpSXmKPExsUixCmqrLvY6HWAwYS9PBbXb85kdmD0eLbq + FnMAYxSXTUpqTmZZapG+XQJXxvejD1gLLgtUXF15lbWBcR5vFyMnh4SAicTy2U1sELaYxIV7 + 64FsLg4hgX2MEk1PnjFDOOsZJXYdWs0C4exnkph/8SBUZi6jRGfPFFaQfjYBDYlt+5czgtgi + AtISO+/OBopzcDALqEn86VIBCQsLeEpcWtcFVs4ioCqx+Op8MJtXwEHi/L//LBBnKEp0P5vA + NoGRdwEjwypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdc73czBK91JTSTYygMGB3UdnB2HxI6RCj + AAejEg/vBYNXAUKsiWXFlbmHGCU5mJREeV0NXgcI8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuH9 + 9gConDclsbIqtSgfJiXNwaIkzns95aa/kEB6YklqdmpqQWoRTFaGg0NJgvetIdBQwaLU9NSK + tMycEoQ0EwcnyHAeoOGPQGp4iwsSc4sz0yHypxgVpcR5H4AkBEASGaV5cL2wOH3FKA70ijDv + N5AqHmCMw3W/AhrMBDQ49fFzkMEliQgpqQbGnQq7++Q/1OwS8Lm/Q0zt95fgiVkOc1Y/NJRi + jeW93dlwJ2V78Pm3v981vTx8T3tH5ARZtiMRllwL5p24H/rhVMyu6g+s31dfvBybd6+Ae8bp + K0x3RQIvMZyPyXgekR2x6M2jI2v/bzvpuFYrfqMeg88SkR2BJZlHf13obJ2eFr1nE3dUk82b + JUosxRmJhlrMRcWJANBDeNquAgAA +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:40:04 -0000 + +Currently, if point is in the middle of a message when the user +collapses it, Emacs then displays the cursor on the header line of the +next message, even though point is still on the collapsed message and +even though, if you explicitly move point to the same visual location, +it will be on the next message. As a result, following actions like +re-expanding the message or modifying tags apply to the collapsed +message, even though, visually, it looks like they will apply to the +message following the collapsed message. + +This patch addresses this by explicitly moving point when a message is +collapsed so it is visually unambiguous that the point is still on the +collapsed message. +--- + emacs/notmuch-show.el | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 5751d98..94b4178 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1363,7 +1363,23 @@ effects." + ;; components. + + (defun notmuch-show-message-visible (props visible-p) +- (overlay-put (plist-get props :message-overlay) 'invisible (not visible-p)) ++ (let ((ov (plist-get props :message-overlay))) ++ (overlay-put ov 'invisible (not visible-p)) ++ (when (not visible-p) ++ ;; If point was contained in the overlay, move it to a sensible ++ ;; spot that is visible and still on the same message. ++ ;; Strangely, the Emacs event loop doesn't move the point out of ++ ;; the invisible region for us like it normally does (perhaps ++ ;; because it doesn't know which way to go), so if we don't do ++ ;; this, it's visually ambiguous which message an action will ++ ;; apply to. ++ (let ((start (overlay-start ov)) ++ (end (overlay-end ov))) ++ (dolist (win (get-buffer-window-list nil nil t)) ++ (with-selected-window win ++ (when (and (<= start (point)) (< (point) end)) ++ (goto-char (1- start)) ++ (beginning-of-visual-line))))))) + (notmuch-show-set-prop :message-visible visible-p props)) + + (defun notmuch-show-headers-visible (props visible-p) +-- +1.7.10.4 + -- 2.26.2