[Profile] [Emacs] [Software] [Webware] [Home]
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. 基本設定

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1 Emacs Collection (1998/1/17)

Emacsを集めて悦に入っています。(^.^)v

いろいろなEmacsで `~/.emacs-Meadow'`~/.emacs-MuleWin32'`~/.xemacs'等々のように別ファイルを作って切替える方法がありますが、 ずぼらな私はひとつの`~/.emacs'中で場合分けして書いています。 (その方がrevision管理が簡単なのですよ。)

そうしたら、

` -rw-r--r-- 1 kose bingo 117983 Jan 17 08:06 .emacs'

おぉ、こんなに肥大化してるぅ。(^.^)

以下のような値(もっとあるのかな)を使って見分けています。

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.1 Emacs System固有値

name value note
system-configuration "i386-*-windows95-4.0" Windows95
"sparc-sun-sunos4.1.4_JL" SunOS4.1.4JLE
"sparc-sun-solaris2.5" Solaris2.5
system-type windows-nt Windows95
usg-unix-v Solaris2.5
berkeley-unix SunOS4.1.4JLE
window-system w32 Meadow
win32 Mule for Win32
x X Window System
Meadow-version "Meadow-1.00 (MIDORI)"
"Meadow-0.50-Beta1 (KASURI)"
"Meadow-Alpha 3.00 (AOI)"
"Meadow-Alpha 2.11 (SIYOU)" 紫陽
emacs-version "20.2.1" Meadow
"19.28" Mule for Win32

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.2 Emacsの見分け方

UNIXでのEmacs20、Mule2.3/Emacs19.xx、XEmacsと Meadow、Mule for Win32の判定してを以下のようにやっています。

(defconst running-UNIX    (or (equal system-type 'berkeley-unix) ;; SunOS
                              (equal system-type 'usg-unix-v)))  ;; Solaris
(defconst running-XEmacs  (featurep 'xemacs))
(defconst running-Emacs20 (and running-UNIX
                               (= emacs-major-version 20)))
(defconst running-Mule2.3 (and running-UNIX (= emacs-major-version 19)))
(defconst running-MuleWin32 (and (equal system-type 'windows-nt)
                                 (= emacs-major-version 19)))
(defconst running-Meadow  (featurep 'meadow))

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.3 Emacs -nwの場合分け

window-systemの設定以外、 Emacs -nwで立ち上げた場合の基本設定をします。

;; -nwの設定
(cond
 (running-Meadow
  ;; ...
  )
 (running-Mule2.3
  ;; ...
  )
 (running-Emacs20
  ;; ...
  )
 (running-XEmacs
  ;; ...
  )
 (running-MuleWin32
  ;; ...
  )
 (t   (message "running unknown Emacs"))
 )

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.4 window-sytemの場合分け

window-sytemでの設定、Fontの設定やframeの設定をします。

(cond
 ((eq window-system 'x)
  ;; ...
  )
 ((eq window-system 'w32)
  ;; ...
  )
 ((eq window-system 'win32)
  ;; ...
  )
 (t   (message "unknown window-system"))
)

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.5 host nameによる場合分け

host nameによって変えたい場合は以下のようにします。

この方法で note PC, Libretto, DeskTopでframeの大きさ等を変えられます。

(cond 
 ((equal system-name "sleepy")  ;; system-name = hostname
  ;; ...
  )
 ((equal system-name "libby")
  ;; ...
  )
 (t 
  ;; ...
  )
 )

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 cygnus GNU-Win32 (1998/1/18, 1/25)

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.1 シェル

シェルに求めるもの。

  1. シェルスクリプトが動く、特にGNUのツールをcompileする時の必需品の configureがきちんと動作すること。

  2. command history、filename completion、command line editing、alias 機能

しかし私はこの 2. の機能はあれば良いという程度にしか思っていません。 それは、シェルを Emacs のshell-modeつまりshell bufferでしか使いませんので、 2. の機能はすべてEmacsのshell-modeが持っている機能(aliasは除く)なのです。 それがあればいいのです。

シェル以外には、grep、make、sed、AWK、gccといった物を一式揃えない事には Emacsの魅力が半減しますから、 cygnus GNU-Win32 を一式インストールします。

シェルには数々の種類があってWindowsにも移植(csh, tcsh, zsh etc.)されていま すが、前述の通り私はシェルにはそれほど 高機能性(そのシェル独自の拡張)を求めていないので、 cygnus GNU-Win32 をインストールするとそのまま使える bash を使っています。

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.2 bash

Meadowで動作がうまくいかないという問題は、 シェルを正しく設定できていないといことがほとんどです。

bash(sh、tcsh、zsh)を使う時は忘れずに

(setq shell-command-option "-c")
を設定し、 ぐらいはここで動作確認しておきましょう。

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.3 ドライブ名の表記方法

以下の話はb18までの話で、b19からは `c:/bin/ls' という表記でも実行できるようになりました。

bash ではドライブの表記方法が特殊です。

コマンドの表記には、//c/bin/shのような書き方をします。 しかしコマンド引数でのパス名(ファイル名)には c:/bin/shの書き方が使えます。

`bash -c //c/bin/ls ... は動く'
`bash -c c:/bin/ls ... は動かない'
`ls //c/bin/ ... は動く'
`ls c:/bin/ ... も動く'

そのため Makefile 中でも EMACS=//h/Meadow/0.50b1/bin/Meadow95.exe を表記して起動します。

なお、cドライブを / にmountしている場合は、//c の部分は省略可能で ls //c/foo/ls /foo/は同じ意味になります。

この表記自体には賛否両論があるかとは思いますが、 Makefile中の表記に : を含んだコマンド名を書くとmakeが混乱する ってなこともあって、まぁ妥協できる案だとは思います。 (1)

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.4 sh script

#! /bin/sh
#! /usr/local/perl
で始まるスクリプトが、bashからは、 /bin/sh script-nameではなく直接./script-name で起動できます。

これ、重宝しますよ。

このおかげで、 Windowsでは、*.shというシェルスクリプト名(拡張子)にbashを関連付けておけば ダブルクリックで動かす事ができます。これは非常に便利なのです。

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3 日本語環境 (1998/1/15)

日本語のための環境設定、Windows IMEを使うための設定です。

;; 日本語環境
(set-language-environment "Japanese")
(set-w32-system-coding-system 'sjis)
(set-clipboard-coding-system 'sjis-dos)
(set-keyboard-coding-system 'sjis)
(mw32-ime-initialize)    ;;;; IME の初期化

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4 フォントの設定 (1998/1/15,1/20)

Windows TrueType Fontを使う方法と、X Window SystemのBDF形式 Fontを 使う方法があります。私は以下の設定でBDF Fontを使っています。

himiさんのBDF font設定例 (meadow-develop:360meadow-develop:361) を参考にしました。

BDF 16dot Fontを使った表示のサンプル画像

;;; $Revision: 1.8 $ $Date: 1998-01-25 11:30:08+09 $ $Author: kose $ 
;;; Maintainer: KOSEKI Yoshinori  <kose@wizard.tamra.co.jp>

;;; Emacs 20.0.92.1 / Mule 3.0 (紅葉賀) / Meadow-0.50-Beta1 (絣) ;;; で使うフォントの設定のサンプル。 ;;; (Xの16dotと同じ表示にする。) ;;; ;;; BDF Font入手先 ;;; o ftp://ftp.etl.go.jp/pub/mule/fonts/ ;;; o $X11R6/xc/fonts/bdf/misc/8x16.bdf ;;; ;; TODO: ;; 1. line-spaceが効かないので調整してある。 ;;

;;; Subject: [meadow-develop:1997/360] ;;; Font setting (was Re:Package SEMI Gnus for Meadow?) ;;; From: Miyashita Hisashi(宮下 尚:HIMI) <himi@bird.scphys.kyoto-u.ac.jp> ;;; X-Ml-Count: 360 ;; --- を低レベルAPIで書き換えた。

(defvar bdf-font-directory "h:/Meadow/bdf/") (defvar bdf-font-name-prefix "bdffont16-")

;; 日本語のみ (setq bdf-font-file-alist ;;'((ascii "non-cjk/etl16-latin1.bdf" 0) '((ascii "8x16.bdf" 0) (latin-iso8859-1 "non-cjk/etl16-latin1.bdf" 1) (latin-iso8859-2 "non-cjk/etl16-latin2.bdf" 1) (latin-iso8859-3 "non-cjk/etl16-latin3.bdf" 1) (latin-iso8859-4 "non-cjk/etl16-latin4.bdf" 1) (japanese-jisx0212 "japanese/min-1-16.bdf" 0) (japanese-jisx0208 "japanese/jiskan16.bdf" 0) (latin-jisx0201 "japanese/8x16rk.bdf" 0) (katakana-jisx0201 "japanese/8x16rk.bdf" 1) ))

(new-fontset "kose-fontset" (mapcar (lambda (x) (let* ((charset (car x)) (filename (expand-file-name (nth 1 x) bdf-font-directory)) (encoding (nth 2 x)) (fontname (concat bdf-font-name-prefix (symbol-name charset)))) (w32-add-font fontname (cons (cons 'encoding-type encoding) '((default-ascent . 0) (relative-compose . 0) (overhang . 0) (base . 15) ;; if line-spaceで調整する? (base . 14) (height . 16) ;; else ;;(base . 15) ;;(height . 19) ;; fi (width . 8)))) (w32-change-font-logfont fontname 0 (list 'bdf-font filename)) ;; (cons charset fontname))) bdf-font-file-alist))

;; ascii -> これではなく8x16.bdfを使う ;;(w32-change-font-logfont ;; (concat bdf-font-name-prefix "ascii") 0 (list 'bdf-font ;; (concat bdf-font-directory "non-cjk/etl16-latin1.bdf"))) ;; 以下 ... 8x16.bdfとはつりあわないけどしかたがない。:-< ;; Bold (w32-change-font-logfont (concat bdf-font-name-prefix "ascii") 1 (list 'bdf-font (concat bdf-font-directory "non-cjk/etl16b-latin1.bdf"))) ;; italic (w32-change-font-logfont (concat bdf-font-name-prefix "ascii") 2 (list 'bdf-font (concat bdf-font-directory "non-cjk/etl16i-latin1.bdf"))) ;; Bold itaric (w32-change-font-logfont (concat bdf-font-name-prefix "ascii") 3 (list 'bdf-font (concat bdf-font-directory "non-cjk/etl16i-latin1.bdf")))

;; (setq default-frame-alist (append (list '(foreground-color . "black") '(background-color . "snow") '(width . 80) ;;'(height . 27) '(top . 0) '(left . 0) '(vertical-scroll-bars . nil) '(font . "kose-fontset") ) default-frame-alist))

;; note PC, Libretto, DeskTopで大きさを変える。 (cond ((equal (getenv "HOSTNAME") "sleepy") (setq default-frame-alist (append (list '(height . 29)) default-frame-alist));; sleepy ) ((equal (getenv "HOSTNAME") "libby") (setq default-frame-alist (append (list '(height . 24)) default-frame-alist));; libby (menu-bar-mode nil) ) (t (setq default-frame-alist (append (list '(height . 37)) default-frame-alist));; others ) )

;; font-setup.el ends here.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.1 まるもじフォント (1998/2/17)

まるもじフォントを使ってみましょう。

まるもじフォント画像例をごらんください。

ftp://ftp.lavender.org/pub/x11/fonts/ から、 8x16maru.bdf.gz, jisksp16.bdf.gz, maru16.bdf.gz, 8x16rkmr.bdf.gz を入手し、以下のような marumoji-font.el を作り、ロードします。

;;; $Revision: 1.1 $ $Date: 1998-02-17 00:04:16+09 $ $Author: kose $ 
;;; Maintainer: KOSEKI Yoshinori  <kose@wizard.tamra.co.jp>

;;; Emacs 20.0.92.1 / Mule 3.0 (紅葉賀) / Meadow-0.50-Beta1 (絣) ;;; で使う“まるもじフォント”の設定のサンプル。 ;;; ;;; まるもじBDF Font入手先 ;;; o ftp://ftp.sol.cs.ritsumei.ac.jp/pub/x11/fonts/ ;;; ;; TODO: ;; 1. 漢字の“まるもじ”ってあるの? ;;

;;; Subject: [meadow-develop:1997/360] ;;; Font setting (was Re:Package SEMI Gnus for Meadow?) ;;; From: Miyashita Hisashi(宮下 尚:HIMI) <himi@bird.scphys.kyoto-u.ac.jp> ;;; X-Ml-Count: 360 ;; --- を流用。

;; BDFフォントのおきばしょ (setq bdf-font-directory "h:/Meadow/bdf/marumoji")

;; “まるもじフォント”のりすと (setq marumoji-font-file-alist '((ascii "8x16maru.bdf" 0) (japanese-jisx0212 "jisksp16.bdf" 0) (japanese-jisx0208 "maru16.bdf" 0) (latin-jisx0201 "8x16rkmr.bdf" 0) (katakana-jisx0201 "8x16rkmr.bdf" 1)))

;; 関数名がバッティングしないように変えてある。 (defun kose-w32-configure-bdf-font (fontset bdf-font-file-alist) (new-fontset fontset (mapcar (lambda (x) (let* ((charset (car x)) (filename (nth 1 x)) (encoding (nth 2 x)) (fontname (concat fontset "-" ;; (symbol-name charset)))) (w32-auto-regist-bdf-font fontname (expand-file-name filename bdf-font-directory) encoding) (cons charset fontname))) bdf-font-file-alist)))

(kose-w32-configure-bdf-font "marumoji" marumoji-font-file-alist)

;; bitmapを追加する時。 ;;(set-fontset-font "marumoji" 'bitmap "Bitmap-16")

;; end of marumoji-font.el

フォントの切替えは、

SHIFT + mouse-1 → fontset → marumoji
で行います。

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.2 へた字フォント (1998/11/22)

へた字(TrueType font)を使ってみましょう。 (へた字フォント画像例は省略)

http://taka4.hello.to/ からフォントを入手し、以下のように hetaji.el を作りロードします。

;;; $Revision: 1.2 $ $Date: 1998-11-22 08:31:37+09 $ $Author: kose $ 
;;; Maintainer: KOSEKI Yoshinori  <kose@wizard.tamra.co.jp>

;;; Emacs 20.2.1 / Mule 3.0 (紅葉賀) / Meadow-1.01 (翠乃珠) ;;; で使う“へたじ フォント”の設定のサンプル。 ;;; ;;; へたじ TrueType font入手先 ;;; o http://www.cats.ne.jp/~taka4/hetaji.html ;;;

;; (let ((font "Courier-13")) (w32-add-font font '((encoding-type . 0) (charset-num . 0) (overhang . 7) (base . 13) (height . 19) (width . 8))) (w32-change-font-logfont font 0 '(w32-logfont "Courier New" 0 -13 400 0 nil nil nil 0 1 3 49)) (w32-change-font-logfont font 1 '(w32-logfont "Courier New" 0 -13 700 0 nil nil nil 0 1 3 49)) (w32-change-font-logfont font 2 '(w32-logfont "Courier New" 0 -13 400 0 t nil nil 0 1 3 49)) (w32-change-font-logfont font 3 '(w32-logfont "Courier New" 0 -13 700 0 t nil nil 0 1 3 49)))

;; (let ((font "Courier-13-ISO-8859-1")) (w32-add-font font '((encoding-type . 1) (charset-num . 0) (overhang . 0) (base . 13) (height . 19) (width . 8))) (w32-change-font-logfont font 0 '(w32-logfont "Courier New" 0 -13 400 0 nil nil nil 0 1 3 49)) (w32-change-font-logfont font 1 '(w32-logfont "Courier New" 0 -13 700 0 nil nil nil 0 1 3 49)) (w32-change-font-logfont font 2 '(w32-logfont "Courier New" 0 -13 400 0 t nil nil 0 1 3 49)) (w32-change-font-logfont font 3 '(w32-logfont "Courier New" 0 -13 700 0 t nil nil 0 1 3 49)))

;; (let ((font "Heta-13")) (w32-add-font font '((encoding-type . 4) (charset-num . 0) (overhang . 0) (base . 13) (height . 19) (width . 8))) (w32-change-font-logfont font 0 '(w32-logfont "へた字" 0 -16 400 0 nil nil nil 128 1 3 49)) (w32-change-font-logfont font 1 '(w32-logfont "へた字" 0 -16 700 0 nil nil nil 128 1 3 49)) (w32-change-font-logfont font 2 '(w32-logfont "へた字" 0 -16 400 0 nil nil nil 128 1 3 17)) (w32-change-font-logfont font 3 '(w32-logfont "へた字" 0 -16 700 0 nil nil nil 128 1 3 17)))

(new-fontset "hetaji-fontset" '((ascii . "Courier-13") (latin-iso8859-1 . "Courier-13-ISO-8859-1") (katakana-jisx0201 . "Heta-13") (japanese-jisx0208 . "Heta-13") (latin-jisx0201 . "Heta-13") ))

;;(set-fontset-font "hetaji-fontset" 'bitmap "Bitmap-16")

;; end of hetaji.el

フォントの切替えは、

SHIFT + mouse-1 → fontset → hetaji-fontset
で行います。

この他にも楽しいフォントがあったら教えてくださいね。

(この“へた字”の存在は Soe さんに教えていただきました。 ありがとうございました。)

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]


# # This document was generated on April, 8 2001 using texi2html 1.61.1


URL: http://www.NetLaputa.ne.jp/~kose
PGP Fingerprint: 59 8E 1E 4D 41 7F DD 80 12 13 47 A3 FB 62 97 44
Copyright (C) 1997, 1998 kose@yk.NetLaputa.ne.jp All Rights Reserved.
XXXXX