[PATCH] emacs: Disambiguate point placement after hiding message
authorAustin Clements <amdragon@MIT.EDU>
Mon, 7 Jan 2013 20:39:49 +0000 (15:39 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:01 +0000 (09:53 -0800)
11/da24c1a10bb7c842b8352667adf65776e816c2 [new file with mode: 0644]

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