Skip to content

Instantly share code, notes, and snippets.

@kdmsnr
Created December 26, 2015 13:21
Show Gist options
  • Save kdmsnr/e31d2a664696ddcf21c7 to your computer and use it in GitHub Desktop.
Save kdmsnr/e31d2a664696ddcf21c7 to your computer and use it in GitHub Desktop.
(defun review-create-imenu-index ()
(let ((index)
(pattern "^\=+\\({.+}\\)? "))
(save-excursion
(goto-char (point-min))
(while (re-search-forward pattern (point-max) t)
(push (cons (buffer-substring-no-properties (line-beginning-position) (line-end-position))
(match-beginning 0)) index))
(nreverse index))))
(add-hook 'review-mode-hook
(lambda()
(setq imenu-create-index-function 'review-create-imenu-index)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment