From 5ddfe344795e5e4310a87679fe311212c9ef5ec9 Mon Sep 17 00:00:00 2001 From: David Raymond Christiansen Date: Tue, 26 Jul 2016 11:37:04 -0400 Subject: [PATCH] Add imenu support to the Emacs mode imenu is a general-purpose index for things in a buffer, used by a variety of Emacs tools to give a list of definitions in the buffer. This adds support for it to the Emacs mode. --- cubicaltt.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cubicaltt.el b/cubicaltt.el index 47fb26f..26b81ed 100644 --- a/cubicaltt.el +++ b/cubicaltt.el @@ -199,6 +199,12 @@ suggestions for completion rather than too few.") (set (make-local-variable 'completion-at-point-functions) '(ctt-completion-at-point)) + ;; Setup imenu, to allow tools such as imenu and Helm to jump + ;; directly to names in the current buffer. + (set (make-local-variable 'imenu-generic-expression) + '(("Definitions" "^\\(?1:[[:word:]']+\\) *[:(]" 1) + ("Datatypes" "^\\s-*data\\s-+\\(?1:[[:word:]']+\\)" 1))) + ;; Clear memory (setq ctt-keywords-regexp nil) (setq ctt-operators-regexp nil) -- 2.34.1