I've read the wiki for AddKeywords and DerivedMode, but I still don't
know how to put them together -- I tried myself, but all existing
behaviours or my original mode (eg, font locking, indenting) are just
gone. [1]
Please provide me with the simplest elisp code frame that derives from an
existing modes, with the following features.
- register a certain extension, .myext or whatever, optional.
- specific that keyword matching is now case insensitive.
- anything else behaves exactly like the original mode.
- add the following example extra keywords.
[1]
;;###autoload
(define-derived-mode my-mode sh-mode "MY"
"Major mode for editing my files.
Turning on My mode and running the normal hook `my-mode-hook'.
"
(interactive)
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
'(my-builtin
nil ; KEYWORDS-ONLY: no
nil ; CASE-FOLD: no
((?_ . "w")) ; SYNTAX-ALIST
))
(run-hooks 'my-mode-hook)
)
(provide 'my-mode)
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: iuav0p$7r5$1@dough.gmane.org">http://lists.debian.org/iuav0p$7r5$1@dough.gmane.org