Zenspider gives us an excellent tip for extending incremental search. Add this to your emacs initialization:
1 2 3 4 5 6
(define-key isearch-mode-map (kbd "C-o") (lambda () (interactive) (let ((case-fold-search isearch-case-fold-search)) (occur (if isearch-regexp isearch-string (regexp-quote isearch-string))))))
This adds an extra keybinding to interactive search (
C-s) that runs
occuron the current search string/regexp, immediately showing all hits in the entire buffer. I use it all the time now.
Seeing as how I run incremental searches subconsciously before even thinking about running occur, I can see myself using this shortcut constantly. I tried it on the emacs tutorial (
C-s foo C-o