summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2015-06-11 15:38:59 +0200
committerAlan Pearce2015-06-11 15:38:59 +0200
commit13290f1c8f69cf45f6c0b621f4bec96df8fd7301 (patch)
tree1ba34a663d2b7b3e99bbe944a5757dbbd052f509
parent5db8dd53007f8d008c6ad1884c5349b3ad69f898 (diff)
downloadnixfiles-13290f1c8f69cf45f6c0b621f4bec96df8fd7301.tar.lz
nixfiles-13290f1c8f69cf45f6c0b621f4bec96df8fd7301.tar.zst
nixfiles-13290f1c8f69cf45f6c0b621f4bec96df8fd7301.zip
Emacs: Add imenu navigation for restclient files
-rw-r--r--tag-emacs/emacs.d/init.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el
index 3c2cb605..49b0f079 100644
--- a/tag-emacs/emacs.d/init.el
+++ b/tag-emacs/emacs.d/init.el
@@ -1441,7 +1441,13 @@ symbol, not word, as I need this for programming the most."
   :mode ("\\.json\\'" . json-mode))
 
 (req-package restclient
-  :mode ("\\.api\\'" . restclient-mode))
+  :mode ("\\.api\\'" . restclient-mode)
+  :config (progn
+            (defun imenu-restclient-sections ()
+              (setq imenu-prev-index-position-function nil)
+              (add-to-list 'imenu-generic-expression '("Services" "^## ?\\(.+\\)$" 1) t)
+              (add-to-list 'imenu-generic-expression '("Calls" "^# ?\\(.+\\)$" 1) t))
+            (add-hook restclient-mode-hook #'imenu-restclient-sections)))
 
 (req-package tern
   :config (progn