Here is a patch that fixes the reported problem. A minimal reproduction test: (ert-deftest totoro () (set-buffer "*scratch*") (insert "setq") (setq next-error-recenter '(4)) (occur "setq") (next-error)) It seems that occur-mode-goto-occurrence should be called after restoring the original buffer. Nathan