FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

LinkBack Thread Tools
Old 06-27-2011, 10:08 PM
T o n g
Default Emacs lisp: Using AddKeywords in DerivedMode


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.

(defconst my-builtin
"ifndef" "include" "endif" "define"
) 'words)



(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'.

(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
nil ; CASE-FOLD: no
((?_ . "w")) ; SYNTAX-ALIST

(run-hooks 'my-mode-hook)

(provide 'my-mode)

Tong (remove underscore(s) to reply)

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

Thread Tools

All times are GMT. The time now is 03:52 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org