emacs: Fix backspace to not scroll more than the previous message
authorCarl Worth <cworth@cworth.org>
Tue, 9 Mar 2010 16:11:45 +0000 (08:11 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 9 Mar 2010 16:11:45 +0000 (08:11 -0800)
The bug was occuring due to counting invisible lines, but then
scrolling past them since they are invisible.

notmuch.el

index cd4d9963fb98c44a7b017faaf85391b24b293649..c611dcc2cc72ebde11568b3e42f2fa6bb0f70f1c 100644 (file)
@@ -647,7 +647,13 @@ any effects from previous calls to
          (condition-case nil
              (scroll-down nil)
            ((beginning-of-buffer) nil))
-         (goto-char (window-start)))
+         (goto-char (window-start))
+         ; Because count-lines counts invivisible lines, we may have
+         ; scrolled to far. If so., notice this and fix it up.
+         (if (< (point) previous)
+             (progn
+               (goto-char previous)
+               (recenter 0))))
       (notmuch-show-previous-message))))
 
 (defun notmuch-show-advance-and-archive ()