Steps to reproduce: Open emacs -Q M-: (progn (linum-mode) (hs-mode)) Insert a block of comments M-x hs-hide-block This might be happening because (window-end nil t) does not return an updated value after the creation of a "hiding" overlay. Although I haven't explored it deep enough, to be sure that it is indeed so. Evgeni