very basic help for writing a new mode

Discussion of Emacs Lisp
Post Reply

very basic help for writing a new mode

Post by wrichards » Mon Sep 01, 2008 11:31 am

I have data files which are sexp's of the form
("tax name 1" various fields follow)
("tax name 2" ...)

I'd like to have a mode which derives from scheme-mode, but with the "tax name" strings as entries
in a buffer index (imenu or ecb). Here's my attempt:

(defvar tax-imenu-generic-expression
'((nil "^\\s-+(\"\\(w+\\)\"" 1)))

(define-derived-mode tax-mode scheme-mode
"major mode for handling tax files"
(make-local-variable 'imenu-generic-expression)
(make-local-variable 'imenu-case-fold-search)
(setq imenu-generic-expression tax-imenu-generic-expression
imenu-case-fold-search nil))

(provide 'tax-mode)

This does the right thing with font-locking, but I can't get it to list the tax names as a buffer index (seems like semantic is still using the scheme-imenu-generic-expression). I'm very new to elisp, so I'm struggling even in figuring out how to debug this. Any suggestions?


Post Reply