yaotti's diary

Software is Eating the World

Emacsのインデント、ハイライト設定

Gauche特有の手続きの場合、Emacsscheme-modeでもハイライトされなかったりインデントがうまくいかなかったりする。
それで設定をしようと思ったのだけれど、.emacsに書くのはどう考えてもアレなのでscheme-mode自体をいじることにした。

そのときいじるファイルはmacのCarbonEmacsなら
/Applications/Emacs.app/Contents/Resources/lisp/progmodes/にあるscheme.el


インデント


scheme.elに
http://karetta.jp/book-node/kahua-seminar2/000735
をコピペ。

ハイライト


ハイライトしたい単語を以下のように追加する。
場所はだいたい300行くらいのとこ。

(defconst scheme-font-lock-keywords-2
  (append scheme-font-lock-keywords-1
   (eval-when-compile
     (list
      ;;
      ;; Control structures.
      (cons
       (concat
	"(" (regexp-opt
	     '("begin" "call-with-current-continuation" "call/cc" 
	       "call-with-input-file" "call-with-output-file" "case" "cond"
	       "do" "else" "for-each" "if" "lambda"
	       "let" "let*" "let-syntax" "letrec" "letrec-syntax"

	       ;;こんな感じで追加する
	       ;; for Gauche
	       "let-optionals*" "fold" "match"
	       
	       ;; Hannes Haug <hannes.haug@student.uni-tuebingen.de> wants:
	       "and" "or" "delay" "force"
	       ;; Stefan Monnier <stefan.monnier@epfl.ch> says don't bother:
	       ;;"quasiquote" "quote" "unquote" "unquote-splicing"
	       "map" "syntax" "syntax-rules") t)
	"\\>") 1)

あとはM-x byte-compile-fileでscheme.elをバイトコンパイルすればOK。
簡単!!