]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.el
notmuch.el: Fix to hide citations in body of read messages.
[notmuch] / notmuch.el
index 667fd6fd35c4193fa095f042c15c40405cac285a..a6cb82360949206cf2993a23af5f68a5c7e74991 100644 (file)
@@ -147,15 +147,19 @@ last message in the buffer."
 (defun notmuch-show-previous-message ()
   "Backup to the beginning of the previous message in the buffer.
 
-Moves to the beginning of the current message if already on the
-first message in the buffer."
+If within a message rather than at the beginning of it, then
+simply move to the beginning of the current message."
   (interactive)
-  (notmuch-show-move-to-current-message-summary-line)
-  ; Go backward twice to skip the current message's marker
-  (re-search-backward notmuch-show-message-begin-regexp nil t)
-  (re-search-backward notmuch-show-message-begin-regexp nil t)
-  (notmuch-show-move-to-current-message-summary-line)
-  (recenter 0))
+  (let ((start (point)))
+    (notmuch-show-move-to-current-message-summary-line)
+    (if (not (< (point) start))
+       ; Go backward twice to skip the current message's marker
+       (progn
+         (re-search-backward notmuch-show-message-begin-regexp nil t)
+         (re-search-backward notmuch-show-message-begin-regexp nil t)
+         (notmuch-show-move-to-current-message-summary-line)
+         ))
+    (recenter 0)))
 
 (defun notmuch-show-mark-read-then-next-message ()
   "Remove uread tag from current message, then advance to next message."
@@ -194,10 +198,10 @@ first message in the buffer."
   (let ((beg (point)))
     (re-search-forward notmuch-show-body-end-regexp)
     (let ((end (match-beginning 0)))
+      (notmuch-show-markup-citations-region beg end)
       (if (not (member "unread" (notmuch-show-get-tags)))
          (overlay-put (make-overlay beg end)
-                      'invisible 'notmuch-show-body-read))
-      (notmuch-show-markup-citations-region beg end))))
+                      'invisible 'notmuch-show-body-read)))))
 
 (defun notmuch-show-markup-header ()
   (re-search-forward notmuch-show-header-begin-regexp)