S'identifier - S'inscrire - Contact

CommunityWiki
Jam session in wikilandia

define-derived-mode

Source :

Maybe I should post little snippets from my .emacs every now and then. Here’s a simple use of DerivedMode and a basic introduction to FontLock.(define-derived-mode campaign-wiki-mode fundamental-mode "Campaign" "Campaign Wiki stuff including Creole Markup and BBCode." (setq font-lock-defaults '(campaign-wiki-font-lock-keywords)))

(defvar campaign-wiki-font-lock-keywords '(("\\[b\\].*?\\[/b\\]" . 'bold) ("\\[i\\].*?\\[/i\\]" . 'italic) ("\\*\\*.*?\\*\\*" . 'bold) ("\\*.*?\\*" . 'bold) ("\\_</.*?/" . 'italic) ("|+=?" . font-lock-string-face) ("\\\\\\\\[ \t]+" . font-lock-warning-face)) "Keywords for Campaign Wiki mode.") This gives me very basic font-locking for Campaign Wiki texts which use a mix of WikiCreole and BBCode. It implements the following:[b]bold[/b] [i]italic[/i] **bold** *bold* /italic/ this/that/there is not italic |= foo | bar \\ followed by whitespace gets a warning It’s not much, but it got me started.Tags: Emacs

le 18.08.08 à 09:56 dans Mind - Version imprimable
Article précédent - Commenter - Article suivant -