2009年5月26日火曜日

What Emacs Commands Do You Use Most and Find Most Useful

http://www.reddit.com/r/programming/comments/8lfx7/what_emacs_commands_do_you_use_most_and_find_most/

M-x align
コードを揃える努力は好きじゃないし、必要もないと思うけど、
回りのコードが揃ってたりすると、見た目を気にして揃えちゃうからなぁ

M-x align

and

M-x align-regexp

Select a bunch of lines like:

int a=1;
float b=2;
char *c="hello";

"M-x align" will turn it into

int    a = 1;
float b = 2;
char *c = "hello";
M-x eshell
M-x shell は常用してるけど、eshellなんてのもあるんだ、vi動くんだw
M-x term なんてのもあったっけ...

emacs22 default日本語環境

OpenBSDにskkを入れるほど根性無いし、
emacs22だと set-input-method "japanese" で kcc 使って日本語入力出来ちゃうので
kccをskkっぽくして、しのぐことにする...中途半端だけどw


(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8-unix)
(set-buffer-file-coding-system 'utf-8-unix)

;; change quail + kkc keybind like skk
(global-set-key "\C-xj" `toggle-input-method)

(defun my-kcc-mode-act-hook ()
;; nn を ん に変換する。
(setq quail-japanese-use-double-n t)

;; 変換中のCtrl-gで変換をキャンセル
(define-key kkc-keymap "\C-g" 'kkc-cancel)

(defun my-kanji-mode ()
(interactive)
(set-input-method "japanese")
)
(defun my-ascii-mode ()
(interactive)
(set-input-method "japanese-ascii")
)
(defun my-katakana-mode ()
(interactive)
(set-input-method "japanese-katakana")
)
(local-set-key "\C-l" 'my-ascii-mode)
(local-set-key "\C-q" 'my-katakana-mode)
(local-set-key "\C-j" 'my-kanji-mode)
)

(defun my-kcc-mode-inact-hook ()
(local-unset-key "\C-l")
(local-unset-key "\C-q")
(local-unset-key "\C-j")
)

(add-hook 'input-method-activate-hook 'my-kcc-mode-act-hook)
(add-hook 'input-method-inactivate-hook 'my-kcc-mode-inact-hook)

2009年5月17日日曜日

Gentoo sys-fs/fuse

emerge --update --deep world したら、

>>> Failed to emerge sys-fs/fuse-2.7.4, Log file:

>>> '/var/tmp/portage/sys-fs/fuse-2.7.4/temp/build.log'

* Messages for package sys-fs/fuse-2.7.4:

* You need to build the FUSE module from the kernel source, because your kernel is too new
* Please check to make sure these options are set correctly.
* Failure to do so may cause unexpected problems.
* Once you have satisfied these options, please try merging
* this package again.

kernelのオプションで、
File systems -> FUSE (Filesystem in Userspace) support
を有効にしないといけないみたい。

make menuconfig でオプション付けて
make && make modules_install
make install
して、再起動してやり直し

2009年5月3日日曜日

OpenBSD 4.5

エミュレータの中だけど、
qemu + kqemu な環境で問題無く動作(4.4以前はダメだった気がする)

1. Xorg 使うなら
/etc/sysctl.conf の machdep.allowaperture を
machdep.allowaperture=2
にする。

2. locale
~/.profile に
export LANG=en_US.UTF-8
これで、emacs の view-hello-file の日本語が見えるようになった

3. Ports
3.1 検索
cd /usr/ports
make search key=HOGEHOGE
make search name=HOGEHOGE

3.2 flavor
検索すると no_x11 とか表示されるヤツは
make show=FLAVORS
で表示して、以下でオプション付けてコンパイル
sudo sh -c "LANG=C FLAVOR=no_x11 make install"