On pure Emacs: open some buffer M-s-o for occur then e for occur-edit-mode, then M-x replace-regexp [ ^I]+ RET SPC RET ;; try to replace excess spaces or tabs by just one space symbol in matched strings Error in minibuffer => Wrong type argument: markerp, nil OS X, Emacs 24.3 -- Best regards, Yuriy Pitomets