I'd like to search a buffer for headlines only. A headline is anything starting with the "
*" character. Ideally, I'd invoke an interactive function which would take user input at the minibuffer. I'd only give it the string I'd like to search for (for example
foo) and not worry about the regex (which would be the headline prefix
"^\*.* " +
foo). The function should behave the same as the classic
regexp-isearch : reading input from the minibuffer, and search for next occurrence if you invoke it again.
Any ideas how I could do this?
I found this code here. I edited it like this :
(defun search-headings () "search for selected text" (interactive) (isearch-mode t t) ; forward + REGEXP (isearch-yank-string "^\*.* " ))
When I call search-headings the minibuffer shows a modified version of my regex, instead of
"^\*.* "it shows