1 ;;; mayu-mode.el --- mayu setting editing commands for Emacs
3 ;;; Copyright (C) 2000-2005 TAGA Nayuta <nayuta@ganaware.org>
5 ;; Author: TAGA Nayuta <nayuta@ganaware.org>
6 ;; Maintainer: TAGA Nayuta <nayuta@ganaware.org>
7 ;; Keywords: languages, faces
12 mayu-font-lock-keywords
14 (if (boundp 'font-lock-warning-face)
15 font-lock-warning-face
16 font-lock-function-name-face))
18 (if (boundp 'font-lock-builtin-face)
19 font-lock-builtin-face
20 font-lock-preprocessor-face))
22 (if (boundp 'font-lock-builtin-face)
23 font-lock-builtin-face
24 font-lock-function-name-face)))
42 ) . font-lock-keyword-face)
43 ("#.*$" . font-lock-comment-face)
44 ("/[^/\n]*/" . font-lock-string-face)
45 ("\\\\$" . ,warning-face)
49 "\\|event\\s +\\(prefixed\\|after-key-up\\|before-key-down\\)"
51 "\\|def\\s +\\(key\\|alias\\|mod\\|sync\\|subst\\|option\\)"
64 ) . ,preprocessor-face)
83 "\\|SetForegroundWindow"
87 "\\|InvestigateCommand"
101 "\\|WindowMoveVisibly"
102 "\\|WindowClingToLeft"
103 "\\|WindowClingToRight"
104 "\\|WindowClingToTop"
105 "\\|WindowClingToBottom"
107 "\\|WindowToggleTopMost"
116 "\\|ClipboardChangeCase"
117 "\\|ClipboardUpcaseWord"
118 "\\|ClipboardDowncaseWord"
120 "\\|EmacsEditKillLinePred"
121 "\\|EmacsEditKillLineFunc"
129 ) . ,function-name-face)
130 "Default font-lock-keywords for mayu mode.")))
132 (defvar mayu-mode-syntax-table nil
133 "syntax table used in mayu mode")
134 (setq mayu-mode-syntax-table (make-syntax-table))
135 (modify-syntax-entry ?# "<\n" mayu-mode-syntax-table)
136 (modify-syntax-entry ?\n ">#" mayu-mode-syntax-table)
138 (defvar mayu-mode-map
139 (let ((map (make-sparse-keymap)))
140 (define-key map "\C-c\C-c" 'comment-region)
145 "A major mode to edit mayu setting files."
147 (kill-all-local-variables)
148 (use-local-map mayu-mode-map)
150 (make-local-variable 'comment-start)
151 (setq comment-start "# ")
152 (make-local-variable 'comment-start-skip)
153 (setq comment-start-skip "\\(^\\|\\s-\\);?#+ *")
154 (make-local-variable 'comment-indent-function)
155 (setq comment-indent-function 'mayu-comment-indent)
156 (make-local-variable 'parse-sexp-ignore-comments)
157 (setq parse-sexp-ignore-comments t)
159 (make-local-variable 'font-lock-defaults)
160 (setq major-mode 'mayu-mode
162 font-lock-defaults '(mayu-font-lock-keywords nil)
164 (set-syntax-table mayu-mode-syntax-table)
165 (run-hooks 'mayu-mode-hook))
167 ;;; derived from perl-mode.el
168 (defun mayu-comment-indent ()
169 (if (and (bolp) (not (eolp)))
170 0 ;Existing comment at bol stays there.
172 (skip-chars-backward " \t")
173 (max (if (bolp) ;Else indent at comment column
174 0 ; except leave at least one space if
175 (1+ (current-column))) ; not at beginning of line.
180 ;;; mayu-mode.el ends here