next up previous
Next: 1.2 Shellの実行 Up: 1 ファイル編集エディタ Emacs Previous: 1 ファイル編集エディタ Emacs

1.1 環境設定ファイル.emacs

ホームディレクトリの.emacsに環境設定ファイルとして インストールディレクトリに置かれる dot.meadow.jaをコピーしておくと IMEなどを用いて日本語を利用できるようになる. 下は,.emacsの例である. Emacsは,Lisp(LISt Processing)言語により 内部の処理が記述されている. 初期環境設定.emacsファイルは,そのEmacs用 Lisp(Emacs Lisp)により記述されている.
;;;
;(load "e:/home/inaba/.emacs.inaba")
;;; 日本語環境設定
(set-language-environment "Japanese")
;;; IMEの設定
(setq default-input-method "MW32-IME")
(mw32-ime-initialize)
(global-unset-key "\C-\\")
(global-set-key "\C-\\" 'toggle-input-method)
(setq-default
     mw32-ime-mode-line-state-indicator
    "[--]")
(setq mw32-ime-mode-line-state-indicator-list
     '("[--]" "[あ]" "[--]"))
(add-hook 'mw32-ime-on-hook
    (function (lambda () (set-cursor-height 2))))
(add-hook 'mw32-ime-off-hook
    (function (lambda () (set-cursor-height 4))))

;;; マウスカーソルを消す設定
(setq w32-hide-mouse-on-key t)
(setq w32-hide-mouse-timeout 5000)

;;; font-lockの設定
(if window-system
    (progn
      (setq font-lock-support-mode 'lazy-lock-mode)
      (global-font-lock-mode t)))

 ;;; TrueType フォント設定
(create-fontset-from-request
 "private-fontset"
 '((width . 8)
   (height . 16)
   (fixed . t)
   (italic . nil))
 '((family . "MS ゴシック")
   (family . "Courier New")))
(change-fontset-from-request
 "private-fontset"
 '((width . 8)
   (height . 16)
   (fixed . t)
   (weight . 700)
   (italic . nil))
 '((family . "MS ゴシック")
   (family . "Courier New"))
 1)

;; 初期フレームの設定
(setq default-frame-alist
  (append (list '(foreground-color . "black")
    '(background-color . "LemonChiffon")
    '(background-color . "gray")
    '(border-color . "black")
    '(mouse-color . "white")
    '(cursor-color . "black")
;;    '(ime-font . "Nihongo-12") ; TrueType のみ
;;    '(font . "bdf-fontset")    ; BDF
;;    '(font . "private-fontset"); TrueType
    '(width . 80)
    '(height . 40)
    '(top . 100)
    '(left . 100)
    '(font . "private-fontset")
    )
   default-frame-alist))

;; ;;; Cygwin の bash を使う場合
(setq explicit-shell-file-name "bash")
(setq shell-file-name "sh")
(setq shell-command-switch "-c") 

;; ;;; Virtually UN*X!にある tcsh.exe を使う場合
;; (setq explicit-shell-file-name "tcsh.exe") 
;; (setq shell-file-name "tcsh.exe") 
;; (setq shell-command-switch "-c") 

;; C-hで一文字消去したい場合
(global-set-key "\C-h" 'backward-delete-char)

(add-hook 'shell-mode-hook
  (lambda ()
    (set-buffer-process-coding-system
    'undecided-dos 'sjis-unix)))
Lisp言語は,カッコ開からカッコ閉までの 一つのフォームが実行文となる. Lispでは,この一つのフォームが結果を 返すため関数と呼ばれる. カッコ開の最初の単語がその関数名となる. 二つ目以降はその関数への引数ということになる. この関数を意味するフォームを実行することは 評価(evaluation)すると言われる. .emacsファイルの中で記述されているフォームは, Emacsが立ち上がる際に,順にevaられて行く.

generated through LaTeX2HTML. M.Inaba 平成18年5月7日