         (while (and (not hetero) (looking-at "[ \t]"))
           (skip-chars-forward " \t")
           (let ((cur-status (ledger-state-from-char (char-after))))
-            (if first
-                (setq state cur-status
-                      first nil)
-		(if (not (eq state cur-status))
-		    (setq hetero t))))
+	    (if (not (eq cur-status 'comment))
+		(if first
+		    (setq state cur-status
+			  first nil)
+		    (if (not (eq state cur-status))
+			(setq hetero t)))))
           (forward-line))
         (when (and (not hetero) (not (eq state nil)))
           (goto-char (car bounds))

        new-status cur-status)
    ;; Uncompact the entry, to make it easier to toggle the
    ;; transaction
    (save-excursion  ;; this excursion unclears the posting
      (goto-char (car bounds))  ;; beginning of xact
      (skip-chars-forward "0-9./= \t") ;; skip the date
      (setq cur-status (and (member (char-after) '(?\* ?\!))

	 'pending)
	((eql state-char ?\*)
	 'cleared)
	((eql state-char ?\;)
	 'comment)
	(t
	 nil)))

