By default, occur uses the passed regexp to match lines in a case-insensitive way. Is there a way to make this matching case-sensitive?
For example, if I run
M-x occur ^function RET, occur will match lines that start with both
Function. I want it to only match
For reference, this is how I am currently using occur to generate a "table of contents" for Perl and other languages:
(defun toc () "Show a 'Table of Contents' for the current file using occur" (interactive) (let (regexp) (if (derived-mode-p 'cperl-mode) ;; for perl (setq regexp "^\\(sub\\|has\\|=head1\\|requires\\) ") (setq regexp "^function ")) ;; for everything else (occur regexp)))