d-mode.el 導入のメモ

  • Emacsのバージョンの確認

M-x version
GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30 on SOFT-MJASON
M-x c-version
Using CC Mode version 5.31.7

(autoload 'd-mode "d-mode" "Major mode for editing D code." t)
(add-to-list 'auto-mode-alist '("\\.d[i]?\\'" . d-mode))
  • d-mode.el を使うとエラーが出るので場当たり的な対処。113〜118行目をコメントアウト。176〜178行目をコメントアウト。これで(表面的には)エラーなく使えるはず。何が起きても自己責任。

patch 当てたい方は以下の diff 使ってくださいな。

  • diff
113,118c113,118
< (c-lang-defconst c-other-op-syntax-tokens
<   "List of the tokens made up of characters in the punctuation or
< parenthesis syntax classes that have uses other than as expression
< operators."
<   d (append '("/+" "+/" "..." ".." "!" "*" "&")
< 	    (c-lang-const c-other-op-syntax-tokens)))
---
> ;;;;; (c-lang-defconst c-other-op-syntax-tokens
> ;;;;;   "List of the tokens made up of characters in the punctuation or
> ;;;;; parenthesis syntax classes that have uses other than as expression
> ;;;;; operators."
> ;;;;;   d (append '("/+" "+/" "..." ".." "!" "*" "&")
> ;;;;; 	    (c-lang-const c-other-op-syntax-tokens)))
176,178c176,178
< (c-lang-defconst c-typedef-decl-kwds
<   d (append (c-lang-const c-typedef-decl-kwds)
< 	    '("typedef" "alias")))
---
> ;;;;; (c-lang-defconst c-typedef-decl-kwds
> ;;;;;   d (append (c-lang-const c-typedef-decl-kwds)
> ;;;;; 	    '("typedef" "alias")))

GNU Emacs と XKeymacs の相性が悪い件

XKeymacs で Emacs に対し個別設定で「XKeymacs を無効にする」にしても,Emacs の C-x を初めとしてキー操作がうまくいかなくなる。
Emacs 23.1 では問題なかったが,Emacs 23.2 にしたところ問題発生。今のところの解決策は XKeymacs 自体を「無効にする」しかない。根本解決方法を知っている方は教えてくださいませ。
他の人の証言。

578 :名無しさん@お腹いっぱい。:2010/04/03(土) 23:41:52 id:dbsVviCcP
emacsとxkeymacs使ってる人います?(厳密には無効設定が出来てる人)
23.1.1の頃は使えてたのに,23.1.9?になったら無効設定が効かなくなった。
なんかwindowのID的なものが拾えてないような挙動
NTEmacs スレッド 2

emacs 23.2 windows版は C-x が効かない。ツンデル。自分だけだろうか。
C-x 効いた。xkeymacsのプロセス落としたら効いたよ。
xkeymacs が有効になってると、emacs23.2はうまく動かないな。23.1は動いてたのに。

何度目かの入門

少しずつなれて,メモ帳との決別をはかりたいところ。

入手

本家:GNU Emacs - GNU Project - Free Software Foundation (FSF)
Windows用のバイナリ:Index of /pub/gnu/emacs/windows
今回ダウンロードしたバイナリ:emacs-23.1-bin-i386.zip

起動時の初期化ファイル

Emacs.emacs.elc, .emacs.el, .emacs の順に見つかったものだけを読み込み実行する。
一般的に .emacs を編集することが多いようだが,私は .emacs.el を編集することにする。必要に応じて .emacs.el をコンパイルし, .emacs.elc を作る予定。

.emacs.el の読み込まれるディレクトリ*1

直接起動した場合

エクスプローラから直接起動した場合は C:\Document and Settings\(ユーザネーム)\Application Data ディレクトリ内

bash から起動した場合

Cygwin Bash から起動した場合は ~


どうやら環境変数 HOME の値によって異なる動作になるらしい。*2
いずれもその読みにいくディレクトリに emacs.d ディレクトリも作られます。

メニューのバグ?

メニュー→Options→Save Options がきかないような気がする。バグ?
メニュー→Options→Show/Hide→Tool-bar のチェックオフすると,一時的にツールバーを消すことができるが,その後 Save Options して Emacs を再起動すると,再びツールバーが表示される。

ツールバーを消す

メニューのオプションが役に立たないので自前(?)で .emacs.el に次のように書く。

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(tool-bar-mode nil nil (tool-bar)))

ウインドウ(フレーム)の位置変更

.emacs.el に次のように書く。

(setq initial-frame-alist '((top . 0) (left . 960 )
			    (width . 115) (height . 62)))

top, left は座標。width, height は行数・列数。それぞれ好みで。
私の場合,ディスプレイ(1920*1080)の右半分に Emacs が表示されるように調整してみた。