emacs html6 mode

Perm url with updates: http://xahlee.org/emacs/elisp_html6-mode.html

Emacs Lisp: html6-mode

Xah Lee, 2010-12-18, 2011-05-16

This page shows a very simple exmple of writing a major mode for emacs.

I suprised myself. In about 10 minutes, i whipped up a html6 mode. lol.

Here's the html 6 spec: HTML6: Your JSON and SXML Simplified.

Here's html6 mode source code:

;;-*- coding: utf-8 -*-
;; xah-html6-mode.el -- Major mode for editing html6.
;; http://xahlee.org/comp/html6.html

;;; HISTORY
;; version 0.1, 2010-12-17

(setq xah-html6-keywords
      '(("〔\\([^ ]+?\\) " . (1 font-lock-function-name-face))
      ("「\\([^ ]+?\\) " . (1 font-lock-variable-name-face))
        ("“\\([^ ]+?\\)”" . (1 font-lock-string-face))
        ) )

(define-derived-mode xah-html6-mode fundamental-mode
  (setq font-lock-defaults '(xah-html6-keywords))
  (setq mode-name "HTML6")
  )

(provide 'html6)

Here's how it colors:

?xmlversion1.0” encoding “utf-8”」〕
〔feedxmlnshttp://www.w3.org/2005/Atom” xml:base “http://xahlee.org/emacs/”」

  〔title Xah's Emacs Blog〕
  〔subtitle Emacs, Emacs, Emacs〕
  〔linkrelself” href “http://xahlee.org/emacs/blog.xml”」〕
  〔linkrelalternate” href “http://xahlee.org/emacs/blog.html”」〕
  〔updated 2010-09-19T14:53:08-07:00〕
  〔author
name Xah Lee〕
   〔uri http://xahlee.org/〕
  〕

  〔id http://xahlee.org/emacs/blog.html〕
  〔icon http://xahlee.org/ics/sum.png〕
  〔rights © 2009, 2010 Xah Lee〕

  〔entry
title Using Emacs's Abbrev Mode for Abbreviation〕
   〔id tag:xahlee.org,2010-09-19:215308〕
   〔updated 2010-09-19T14:53:08-07:00〕
   〔summary tutorial〕
   〔linkrelalternate” href “http://xahlee.org/emacs/emacs_abbrev_mode.html”」〕
  〕
〕

For a detailed tutorial, see: How To Write A Emacs Major Mode For Syntax Coloring.

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs