Skip to content

Instantly share code, notes, and snippets.

@penguin2716
Created August 1, 2012 09:56
Show Gist options
  • Select an option

  • Save penguin2716/3225539 to your computer and use it in GitHub Desktop.

Select an option

Save penguin2716/3225539 to your computer and use it in GitHub Desktop.
Mio用の色付け用メジャーモード
;;-*- Emacs-Lisp -*-
(require 'font-lock)
(defun mio-mode()
;; "Mio Mode"
(interactive)
(kill-all-local-variables)
(setq mode-name "Mio")
(setq major-mode 'mio-mode)
(run-hooks 'mio-mode-hook))
(defun mio-insert-h1()
(interactive)
(insert "h1. "))
(defun mio-insert-h2()
(interactive)
(insert "h2. "))
(defun mio-insert-h3()
(interactive)
(insert "h3. "))
(defun mio-insert-h4()
(interactive)
(insert "h4. "))
(defun mio-insert-pre()
(interactive)
(insert "<pre>\n\n</pre>")
(forward-line -1))
(defun mio-insert-del()
(interactive)
(insert "<del>\n\n</del>")
(forward-line -1))
(defun mio-insert-item()
(interactive)
(insert "* "))
;; /usr/share/emacs/23.4/lisp/generic-x.el
;; M-x list-faces-display
(define-generic-mode mio-mode
nil nil
'(("^\\(h[0-9]\\.\\) +\\(.*\\)$"
(1 font-lock-keyword-face)
(2 font-lock-function-name-face))
("^\\(\\*\\) +\\(.*\\)$"
(1 font-lock-keyword-face)
(2 font-lock-warning-face))
("\\(<pre>\\)\\(\\(.\\|
\\)*?\\)\\(</pre>\\)"
(1 font-lock-type-face t)
(2 font-lock-constant-face t)
(4 font-lock-type-face t))
("\\(<del>\\)\\(.*\\)"
(1 font-lock-type-face t)
(2 font-lock-warning-face t))
("\\(<del>\\)\\(.*?\\)\\(</del>\\)"
(1 font-lock-type-face t)
(2 font-lock-builtin-face t)
(3 font-lock-type-face t))
("\\!.*\\!" . font-lock-preprocessor-face)
("\".*\":\\([^
]*.\\)". font-lock-preprocessor-face)
("^\\*+" . font-lock-type-face)
)
nil nil)
(setq auto-mode-alist
(cons (cons "\\.mio$" 'mio-mode) auto-mode-alist))
(provide 'mio-mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment