;--------------------------------------------------------------------- ; ayaori-mode ; ; $Modtime: 03/07/29 22:58 $ ; $Revision: 2 $ ; ; Copyright (C) Silent Factory 1994. All rights reserved. ; - Yuiti SHINOZAKI - ;--------------------------------------------------------------------- ; ・c-modeからインデントもらうようにした ; ・とりあえずコメントと適当な予約語だけ色ついていればいいでしょ ;--------------------------------------------------------------------- ; 使用方法 ; ; 1.下のようなものを site-lisp.l へ追加する。 ; .xyzzy へ追加したい人はよくわからない。 ; ちなみにバイトコンパイルして動作するかどうかは詳細不明。 ; ; 綾織 モード ;(in-package "editor") ;(export 'ayaori-mode) ;(autoload 'ayaori-mode "ayaori-mode" t) ;(pushnew '("\\.aya$" . ayaori-mode) *auto-mode-alist*) ;(in-package "user") ; ; 2.書き込んだあと、%XYZZYHOME%/XYZZZY. ファイルを消して、 ; xyzzy を起動すれば取り込まれるはず ; ;--------------------------------------------------------------------- (provide "ayaori-mode") (in-package "editor") ;--------------------------------------------------------------------- ; グローバル export ;--------------------------------------------------------------------- (export '(*ayaori-mode-hook* *ayaori-keyword-file*)) (export '(ayaori-mode)) ;--------------------------------------------------------------------- ; アスタリスクついたヤツ ;--------------------------------------------------------------------- (defvar *ayaori-mode-hook* nil) (defvar *ayaori-keyword-file* "ayaori-mode") (defvar *ayaori-keyword-hash-table* nil) ; モードマップ (defvar *ayaori-mode-map* nil) (unless *ayaori-mode-map* (setq *ayaori-mode-map* (make-sparse-keymap)) (define-key *ayaori-mode-map* #\TAB 'self-insert-command) (define-key *ayaori-mode-map* #\{ 'c-electric-insert) (define-key *ayaori-mode-map* #\: 'c-electric-insert) (define-key *ayaori-mode-map* #\# 'c-electric-insert) (define-key *ayaori-mode-map* #\} 'c-electric-close) (define-key *ayaori-mode-map* #\C-h 'backward-delete-char-untabify-or-selection) (define-key *ayaori-mode-map* #\C-M-q 'indent-sexp) (define-key *ayaori-mode-map* #\RET 'c-newline-and-indent)) ;シンタックス (defvar *ayaori-mode-syntax-table* nil) (unless *ayaori-mode-syntax-table* (setq *ayaori-mode-syntax-table* (make-syntax-table)) (set-syntax-string *ayaori-mode-syntax-table* #\") (set-syntax-escape *ayaori-mode-syntax-table* #\\) (set-syntax-symbol *ayaori-mode-syntax-table* #\#) (set-syntax-match *ayaori-mode-syntax-table* #\( #\)) (set-syntax-match *ayaori-mode-syntax-table* #\{ #\}) (set-syntax-match *ayaori-mode-syntax-table* #\[ #\]) (set-syntax-word *ayaori-mode-syntax-table* #\.) (set-syntax-word *ayaori-mode-syntax-table* #\_) (set-syntax-punctuation *ayaori-mode-syntax-table* #\@) (set-syntax-start-multi-comment *ayaori-mode-syntax-table* "/*") (set-syntax-end-multi-comment *ayaori-mode-syntax-table* "*/") (set-syntax-start-c++-comment *ayaori-mode-syntax-table* #\/) (set-syntax-end-c++-comment *ayaori-mode-syntax-table* #\LFD)) ; インデント ;(unless (boundp 'c-indent-level) ; (setq c-indent-level 4) ; (setq c-continued-statement-offset 4) ; (setq c-argdecl-indent 4) ; (setq c-brace-offset -4) ; (setq c-brace-imaginary-offset 0) ; (setq c-label-offset -4) ; (setq c-comment-indent 0)) ;--------------------------------------------------------------------- ; 関数 ;--------------------------------------------------------------------- ;--------------------------------------------------------------------- ; 最終設定 ;--------------------------------------------------------------------- (defun ayaori-mode () (interactive) (kill-all-local-variables) (setq mode-name "綾織") (setq buffer-mode 'ayaori-mode) ;キーマップ (use-keymap *ayaori-mode-map*) ;シンタックス (use-syntax-table *ayaori-mode-syntax-table*) ;インデント (setq mode-specific-indent-command 'c-indent-line) ;キーワード (and *ayaori-keyword-file* (null *ayaori-keyword-hash-table*) (setq *ayaori-keyword-hash-table* (load-keyword-file *ayaori-keyword-file*))) (when *ayaori-keyword-hash-table* (make-local-variable 'keyword-hash-table) (setq keyword-hash-table *ayaori-keyword-hash-table*)) (run-hooks '*ayaori-mode-hook*))