Hello,

I have one big org-file for a lot of smaller projects,
each of them represented by a toplevel item.

And I have difficulties finding them quickly:
In most cases I know a buzzword from the headline;
however, if I do a search-forward I normally find
some other text within the body of an unrelated project
further above in the file; and only after several
repetitions of search I find the toplevel heading
(i.e. the project) I was looking for.

To make it easier to search only among toplevel headings
(i.e. among the the titles of my projects),
I wrote this small piece of elisp,
which lives in my initialization-file (e.g. .emacs):

(define-key org-mode-map
  [(f11)]
  (lambda () (interactive)
    (progn
      (occur (concat "^\\* .*"
                     (read-from-minibuffer
                      "Occur for toplevel headlines containing: "))
             nil)
      (pop-to-buffer "*Occur*")
      (use-local-map (copy-keymap (current-local-map)))
      (local-set-key (kbd "RET")
                     (lambda () (interactive)
                       (progn
                         (occur-mode-goto-occurrence)
                         (delete-other-windows)))))))


To find a project I just press f11 (please choose your own key) and
enter a keyword to do an occur for this keyword. Normally several toplevel
headings are found and the right one is chosen by typing return.

I hope, that someone might find this useful too.

with kind regards, Marc-Oliver Ihm


Reply via email to