Meadow2の覚書


2007/10/14
.emacs
;;;
;;; .emacs
;;;
;;; 注意。iso-2022-jp-*で記録すること。でないとMeadowで一部
;;; 表示がおかしくなる。
;;; 2007-10-12 tiutiu.net
;;; meadow2.0用のコードを追加
;;; meadow2のdot.emacs.jaを参考
;;;
;;; meadow2.0用の設定
;;;
(cond ((and (featurep 'meadow)
(eq emacs-major-version '21))
;;; 日本語環境の設定
(set-language-environment "Japanese")
;;; IMEの設定
(mw32-ime-initialize)
(setq default-input-method "MW32-IME")
(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))))
;;; 日本語変換の設定 Ctrl+oで切り替えられるように。
;;; 参考
;;; http://homepage2.nifty.com/DEN03131/win/emacs21.html
;;; ありがとうございます!
(global-set-key "\C-o" 'toggle-input-method)
;;; フレームのディフォルトの設定。
(setq default-frame-alist
(append (list '(foreground-color . "white")
'(background-color . "black")
'(border-color . "black")
'(mouse-color . "red") ; ???
'(cursor-color . "white") ;
'(width . 80) ; フレームの横幅
'(height . 28) ; フレームの高さ
'(top . 1) ; フレームのX座標の位置
'(left . 1)) ; フレームのY座標の位置
default-frame-alist))
;;; フォントの設定
;;; create-fontset-from-requestを使うと簡単にできるが,
;;; あまり満足のいくできばえではない。
;;; 参考
;;; http://homepage3.nifty.com/yoshimov/tips/meadow2.html
;;; 本当に感謝する!!
;;; meadow 1.xの時と比べるとこの設定だとやや小さい。
;;; また, "MSゴシック"に関して, 真ん中の空白は全角ではなく
;;; 半角を使用すること。でないと, Courier Newになってしまう。
;;; とはいえ, 基本ではあるので残しておくこと。
;;; heightをany以外にすると, Courier Newに戻る。とりえない
;;; 値なのだろうか。
(w32-add-font
"gothic9"
'((strict-spec
((:char-spec ascii :height any :weight normal :slant normal)
(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 0 1 3 49))
((:char-spec latin-iso8859-1 :height any)
(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 0 1 3 49))
((:char-spec latin-jisx0201 :height any)
(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 0 128 3 49))
((:char-spec katakana-jisx0201 :height any)
(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 128 1 3 49))
((:char-spec japanese-jisx0208 :height any)
(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 128 1 3 49)))))
;;; デフォルトのフォントの設定
(setq default-frame-alist
(append (list
'(font . "gothic9") ; 通常のフォント
'(ime-font . (w32-logfont ; 変換待ち中のフォント設定
"MS ゴシック" ; ここにgothic9とは書けないようだ。
0 -15 400 0 nil nil nil
128 1 3 49)))
default-frame-alist))
;;; homeでbuffer(page)の先頭に戻る。1.xでは無設定でできたのに。
;;; 参考 http://www.geocities.co.jp/SiliconValley/4805/memo/Meadow2_01.htm
(global-set-key [home] 'beginning-of-buffer) ; or backward-page
(global-set-key [end] 'end-of-buffer) ; or forward-page
)) ; /Meadow2の場合
;;;
;;; meadow1.15用の設定
;;;
(cond
((and (featurep 'meadow)
(eq emacs-major-version '20)) ; for Meadow1.x
;;; 条件参考: http://www.comp.sd.keio.ac.jp/~yakoh/programming/.emacs
;;;
;;; coding-systemの設定
;;;
(set-language-environment "Japanese")
(set-w32-system-coding-system 'sjis)
(set-clipboard-coding-system 'sjis-dos)
(set-keyboard-coding-system 'sjis)
;;; 日本語入力設定時, "あ"と出るようにする設定
(setq mw32-ime-mode-line-state-indicator-list '("[--]" "[あ]" "[--]"))
;;;
;;; IMEの設定
;;;
(mw32-ime-initialize)
(setq default-input-method "MW32-IME")
;;; 日本語変換の設定 Ctrl+oで切り替えられるように。
;;; 参考
;;; http://homepage2.nifty.com/DEN03131/win/emacs21.html
;;; ありがとうございます!
(global-set-key "\C-o" 'toggle-input-method)
;;;
;;; フォントの設定。
;;;
;;; 参考
;;; http://www.boreas.dti.ne.jp/~miyoshi/Meadow/basic_config.html#font_config
;;; ありがとうございます!
;;; http://www5b.biglobe.ne.jp/~kaz-hat/PalmProg/.emacs
;;; ありがとうございます!!
;;; D:\Meadow\README.Meadow.ja
;;;
;;; Meadowのフォントはまず, どんなフォントを作成したいかw32-add-fontで設定した後,
;;; 実際のフォントをw32-add-fontで作成したフォントに割り当てる。
;;; w32-add-fontで作成したフォントを論理フォントと呼ぶらしい。
;;;
;;; フォントの調整でもっとも重要なのは, w32-add-fontの高さと幅
;;; w32-change-font-logfontで使用している, w32-logfontの高さ。
;;; これらの調整がもっとも影響大。
;;; Mule for windowsのgothic9に限りなく私なりに近づけてみたフォント
(w32-add-font "gothic9-ascii"
'((encoding-type . 0) ; コーディング方式
(overhang . 0) ; 傾き
(base . 12) ; ベース
(height . 17) ; 高さ
(width . 9))) ; 幅
(w32-add-font "gothic9-latin-iso8859-1"
'((encoding-type . 0) ; コーディング方式
(overhang . 0) ; 傾き
(base . 12) ; ベース
(height . 17) ; 高さ
(width . 9))) ; 幅
(w32-add-font "gothic9-latin-jisx0201"
'((encoding-type . 0) ; コーディング方式
(overhang . 0) ; 傾き
(base . 12) ; ベース
(height . 17) ; 高さ
(width . 9))) ; 幅
(w32-add-font "gothic9-katakana-jisx0201"
'((encoding-type . 4) ; コーディング方式
(overhang . 0) ; 傾き
(base . 12) ; ベース
(height . 17) ; 高さ
(width . 9))) ; 幅
(w32-add-font "gothic9-japanese-jisx0208"
'((encoding-type . 4) ; コーディング方式
(overhang . 0) ; 傾き
(base . 12) ; ベース
(height . 17) ; 高さ
(width . 9))) ; 幅
;;; 論理フォントを実フォントに割り当てる。
;;; w32-logfont 名前 幅 高さ 太さ
;;; なぜか高さは負の方向へ増やすと大きくなる。
(w32-change-font-logfont
"gothic9-ascii" 0 '(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 0 1 3 49))
(w32-change-font-logfont
"gothic9-latin-iso8859-1" 0 '(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 0 1 3 49))
(w32-change-font-logfont
"gothic9-latin-jisx0201" 0 '(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 0 128 3 49))
(w32-change-font-logfont
"gothic9-katakana-jisx0201" 0 '(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 128 1 3 49))
(w32-change-font-logfont
"gothic9-japanese-jisx0208" 0 '(w32-logfont "MS ゴシック" 0 -15 400 0 nil nil nil 128 1 3 49))
;;; 作ったフォントをグループにまとめる
(new-fontset "gothic9" '((ascii . "gothic9-ascii")
(latin-iso8859-1 . "gothic9-latin-iso8859-1")
(latin-jisx0201 . "gothic9-latin-jisx0201")
(katakana-jisx0201 . "gothic9-katakana-jisx0201")
(japanese-jisx0208 . "gothic9-japanese-jisx0208")))
;;; 2番目に参考にさせてもらった人のパクリという話も。
;;; fixedsys-ascii という名のフォントの作成
;;; 本来はgothic8とかが正しいかも
;;; アスキー
(w32-add-font "fixedsys-ascii"
'((default-ascent . 0)
(relative-compose . 0)
(encoding-type . 0) ; コーディング方式
(overhang . 0) ; オーバーハング(傾き)
(base . 12) ; ベース
(height . 15) ; 高さ
(width . 7))) ; 幅
;; 論理フォントの指定(ノーマル)
(w32-change-font-logfont "fixedsys-ascii" 0
'(w32-logfont "MS ゴシック" 0 -12 400 0 nil nil nil 128 1 3 49))
;; '(w32-logfont "FixedSys" 8 16 400 0 nil nil nil 128 1 1 1))
;; 論理フォントの指定(ボールド)
(w32-change-font-logfont "fixedsys-ascii" 1
'(w32-logfont "MS ゴシック" 0 -12 700 0 nil nil nil 128 1 3 49))
;; 論理フォントの指定(イタリック)
;;(w32-change-font-logfont
;; "w32-ascii" 2 '(w32-logfont "Courier New" 0 -13 400 0 t nil nil 0 1 3 49))
;; 論理フォントの指定(ボールド・イタリック)
;;(w32-change-font-logfont
;; "w32-ascii" 3 '(w32-logfont "Courier New" 0 -13 700 0 t nil nil 0 1 3 49))
;;; カタカナ
(w32-add-font "fixedsys-katakana"
'((default-ascent . 0)
(relative-compose . 0)
(encoding-type . 1)
(overhang . 0)
(base . 12)
(height . 15)
(width . 7)))
(w32-change-font-logfont "fixedsys-katakana" 0
'(w32-logfont "MS ゴシック" 0 -12 400 0 nil nil nil 128 1 3 49))
;;; Shift-JIS
(w32-add-font "fixedsys-jisx0208"
'((default-ascent . 0)
(relative-compose . 0)
(encoding-type . 4)
(overhang . 0)
(base . 12)
(height . 15)
(width . 7)))
(w32-change-font-logfont "fixedsys-jisx0208" 0
'(w32-logfont "MS ゴシック" 0 -12 400 0 nil nil nil 128 1 3 49))
;;; フォントセットの作成
;;; ascii 文字集合を fixedsys-ascii というフォントで表示する
(new-fontset "fixedsys-fontset"
'((ascii . "fixedsys-ascii")
(katakana-jisx0201 . "fixedsys-katakana")
(japanese-jisx0208 . "fixedsys-jisx0208")))
;;; 簡単にフォントを作成する場合はこちら。
;;; 私としてはあまり思い通りに出来ないので, あまり好きではないが。
;;; あと, create-fontset-from-requesがあると起動が遅くなる感じがする。
;(create-fontset-from-request "pre-fontset"
; '((width . 7)
; (height . 15)
; (fixed . t)
; (weight . 400)
; (italic . nil))
; '((family . "MS ゴシック")
; (family . "Andale Mono")))
;; (family . "Courier")))
;(create-fontset-from-request "private-fontset"
; '((width . 9)
; (height . 18)
; (fixed . t)
; (weight . 400)
; (italic . nil))
; '((family . "MS ゴシック")
;; (family . "Andale Mono")))
;; (family . "FixedSys")))
;; (family . "Terminal")))
;; (family . "Courier")))
;; (family . "Courier New")))
;;; ボールドの場合を追加
;(change-fontset-from-request "private-fontset"
; '((width . 9)
; (height . 18)
; (fixed . t)
; (weight . 700)
; (italic . nil))
; '((family . "MS ゴシック")
; (family . "Courier New"))
; 1)
;;; イタリック体の場合の追加
; (change-fontset-from-request "private-fontset"
; '((width . 9)
; (height . 18)
; (fixed . t)
; (weight . 400)
; (italic . t))
; '((family . "MS ゴシック")
; (family . "Courier New"))
; 2)
;;; ボールドイタリック体の追加
;(change-fontset-from-request "private-fontset"
; '((width . 9)
; (height . 18)
; (fixed . t)
; (weight . 700)
; (italic . t))
; '((family . "MS ゴシック")
; (family . "Courier New"))
; 3)
;;; フォントのデフォルトセットの設定
(setq default-frame-alist
(append (list
'(font . "gothic9") ; 通常のフォント
'(ime-font . "gothic9-japanese-jisx0208"); 変換待ち中
; のフォント設定
)
default-frame-alist))
;;; フレームのディフォルトの設定。
(setq default-frame-alist
(append (list '(foreground-color . "white")
'(background-color . "black")
'(mouse-color . "red") ; Meadowでは効かない?
'(cursor-color . "blue") ; Meadowでは効かない?
'(width . 80) ; フレームの横幅
'(height . 27) ; フレームの高さ
'(top . 1) ; フレームのX座標の位置
'(left . 1)) ; フレームのY座標の位置
default-frame-alist))
)) ; /meadow1.15用の設定
;;;
;;; Mule for Windows 特有の設定
;;;
(cond
((boundp 'MULE)
(load "win32fontset")
;;; 日本語変換のトグルキーの設定
;;; Ctrl+Spaceも一応載せるが, それをやると, Cut&Pasteがややこしくなる
;;; (set-ime-toggle-key [?\C-\ ]) ;Ctrl+spaceで日本語と英語を行ったり来り
;;; (set-ime-toggle-key (quote [4194336])) ;Ctrl+spaceで日本語と英語を行ったり来り
(set-ime-toggle-key "\C-\\") ;Ctrl+backslashで日本語と英語を行ったり来り
;できるようにする設定
(set-ime-toggle-key "\C-o") ;Ctrl+o
(set-cursor-color "blue")
;;; フレームのデフォルトの設定。
(setq default-frame-alist
(append (list '(foreground-color . "white")
'(background-color . "black")
'(width . 80) ; フレームの横幅
'(height . 27) ; フレームの高さ
'(top . 1) ; フレームのX座標の位置
'(left . 1) ; フレームのY座標の位置
'(fontset . "Gothic-9"))
default-frame-alist))
;;; 色をつける設定
(load "hilit19.el")
;;; html-helper
(setq load-path
(cons (expand-file-name
(concat exec-directory "../local-lisp/html-helper"))
load-path))
(setq auto-mode-alist (append '(("\\.htm\\'" . html-helper-mode)
("\\.html\\'" . html-helper-mode))
auto-mode-alist))
(autoload 'html-helper-mode "html-helper-mode" "HTML Helper Mode" t)
(setq html-helper-mode-hook 'turn-on-auto-fill)
)) ; /Mule for Windowsの場合
;;; mule, meadow1.x, meadow2.0で共通
;;; 下を押しても,新しい行が増えないよう設定
(setq next-line-add-newlines nil)
;;; 常にline-number-modeであるように設定。
(line-number-mode t)
;;; Tabの長さ
(setq-default tab-width 4)
;;; latexモードで自動改行
(setq latex-mode-hook 'turn-on-auto-fill)
(setq tex-mode-hook 'turn-on-auto-fill)
;;; .cppでもjavaでもcモードに入る。
(setq auto-mode-alist
(cons ' ( "\\.cpp\\'" . c-mode) auto-mode-alist))
(setq auto-mode-alist
(cons ' ( "\\.java\\'" . c-mode) auto-mode-alist))
(setq auto-mode-alist
(cons ' ( "\\.cs\\'" . c-mode) auto-mode-alist))
;;; .plはfundamental-modeに
(setq auto-mode-alist
(cons ' ( "\\.pl\\'" . fundamental-mode) auto-mode-alist))
;;; ^M をとる
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
;;; 音を鳴らさない。
(setq visible-bell t)
;;; 以上に間違いがあったらすべて無効にする。
(put 'eval-expression 'disabled nil)
Meadow1.xとMeadow2.xでは文字の設定方法がもっとも 大きく異なる。
コマンドプロンプトからの独立
2.00/bin/meadow.exeをコマンドプロンプトあるいはcygwinから実行すると コマンドプロンプトはMeadowの終了まで待たされる。 2.00/bin/RunMW32.exeにて実行すれば, 起動後に Meadow2がコマンドプロンプトから独立してMeadow2の終了に 関係なく, コマンドプロンプトが終了できる。
移動
ページの最後への移動はforward-pageかend-of-bufferで キーバインドはM->, ページの先頭への移動は backward-pageかbeginning-of-bufferでキーバインドは M-<。
Meadow1.xでは, end, homeボタンで同じことが 無設定でできる。