From 91a4c947309801409a0b3431c1e1936ecaa93af6 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sun, 13 Jan 2013 15:08:21 +0200 Subject: [PATCH] Add imenu support for markdown-mode. --- init.el | 1 + modules/prelude-markdown.el | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 modules/prelude-markdown.el diff --git a/init.el b/init.el index 36bc73c..da51ca2 100644 --- a/init.el +++ b/init.el @@ -102,6 +102,7 @@ Emacs load path." (require 'prelude-js) (require 'prelude-latex) (require 'prelude-lisp) +(require 'prelude-markdown) (require 'prelude-mediawiki) (require 'prelude-org) (require 'prelude-perl) diff --git a/modules/prelude-markdown.el b/modules/prelude-markdown.el new file mode 100644 index 0000000..7f6167a --- /dev/null +++ b/modules/prelude-markdown.el @@ -0,0 +1,18 @@ +(prelude-ensure-module-deps '(markdown-mode)) + +(setq markdown-imenu-generic-expression + '(("title" "^\\(.*\\)[\n]=+$" 1) + ("h2-" "^\\(.*\\)[\n]-+$" 1) + ("h1" "^# \\(.*\\)$" 1) + ("h2" "^## \\(.*\\)$" 1) + ("h3" "^### \\(.*\\)$" 1) + ("h4" "^#### \\(.*\\)$" 1) + ("h5" "^##### \\(.*\\)$" 1) + ("h6" "^###### \\(.*\\)$" 1) + ("fn" "^\\[\\^\\(.*\\)\\]" 1))) + +(add-hook 'markdown-mode-hook + (lambda () + (setq imenu-generic-expression markdown-imenu-generic-expression))) + +(provide 'prelude-markdown)