I would like to search for certain doxygen like pattern in my files and then add corresponding entries to a speedbar for easy browsing. Some of these entries I want to have colored in red.

I figured out that I can use imenu-generic-expression to easily add entries to my speedbar:

(require 'speedbar)
(speedbar-add-supported-extension ".foo")

(add-hook 'foo-mode-hook
          (lambda ()
            (setq imenu-generic-expression
                  '(("BARS" "@bar\\s-+\\(.*\\)" 1)
                    ("FOOS" "@foo\\s-+\\(.*\\)" 1)))
            ; no auto-grouping
            (setq speedbar-tag-hierarchy-method nil)
            (imenu-add-to-menubar "FOO")))

But how can I get the colors?

  • Imenu uses the menu system of whatever toolkit Emacs uses for your platform. I don't know of a way, from Emacs, to color or otherwise apply text properties to menu items. – Drew Mar 13 '15 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.