[Patch] Fix Emacs interface bug dealing with invisible text

Subject: [Patch] Fix Emacs interface bug dealing with invisible text

Date: Fri, 28 Oct 2011 20:29:49 -0400

To: notmuch@notmuchmail.org

Cc:

From: Ivy Foster


Hey, folks,

I'm new to notmuch, but like much of what I've tried so far.
Thanks to all the contributors!

The following patch fixes a bug I've noticed in Emacs's
notmuch-show mode. Specifically, if you:

    - have certain kinds of washing turned on (I've noticed
      it with signature hiding), and

    - are looking at the last or only message in a thread

If you then hit Space (`notmuch-show-advance-or-archive') to
move on, Emacs will fail to advance and/or archive the
message, due to being kicked out of area of the invisible
text before it can do what it's gotta do.

The patch should fix the problem at the root, which seems to
be with notmuch-show-move-past-invisible-[forward|backward].

So far, I'm the only tester. However, I have added a
signature to the end of this message for your convenience.
(-:

Share & Enjoy!

Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us>
>From 61ac45b32b70f2e789004359e219bfe6b77c701e Mon Sep 17 00:00:00 2001
From: Ivy Foster <joyfulgirl@archlinux.us>
Date: Fri, 28 Oct 2011 19:30:45 -0400
Subject: [PATCH 1/1] Move past invisible text properly in Emacs

    move-past-invisible-text-* in notmuch-show were
    interacting oddly with hidden text at the end of
    a thread, such as a washed signature block.
---
 emacs/notmuch-show.el |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 440e089..f14696b 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1017,12 +1017,16 @@ All currently available key bindings:
     t))

 (defun notmuch-show-move-past-invisible-forward ()
-  (while (point-invisible-p)
-    (forward-char)))
+  (let ((disable-point-adjustment t))
+    (goto-char (1+ (point)))
+    (while (invisible-p (point))
+      (goto-char (1+ (point))))))

 (defun notmuch-show-move-past-invisible-backward ()
-  (while (point-invisible-p)
-    (backward-char)))
+  (let ((disable-point-adjustment t))
+    (goto-char (1- (point)))
+    (while (invisible-p (point))
+      (goto-char (1- (point))))))

 ;; Functions relating to the visibility of messages and their
 ;; components.
@@ -1160,7 +1164,7 @@ which this thread was originally shown."
      ;; go to the end, walk back over invisible text and then see if
      ;; point is visible.
      ((save-excursion
-	(goto-char (- end-of-this-message 1))
+	(goto-char end-of-this-message)
        (notmuch-show-move-past-invisible-backward)
        (> (point) (window-end)))
       ;; The bottom of this message is not visible - scroll.
-- 
1.7.7.1

P.S.: I also tried this with (point-invisible-p) instead of
      (invisible-p (point)), but for whatever reason, it
      didn't work. That may be something to look into as
      well.

-- 
Quid me anxius sum?
[ What? Me, worry? ]

Thread: