]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.el
emacs: Fix backspace to not scroll more than the previous message
[notmuch] / notmuch.el
index 5577dde797b6a6462fef23ae7c37c1845051f802..c611dcc2cc72ebde11568b3e42f2fa6bb0f70f1c 100644 (file)
@@ -592,7 +592,7 @@ Returns nil if already on the first message in the buffer."
              nil
            t))
       (recenter 0)
-      (nil))))
+      nil)))
 
 (defun notmuch-show-previous-message ()
   "Backup to the previous message (whether open or closed)
@@ -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 ()