dreamedge.net

Emacs22で矢印記号とかの文字幅がおかしくなる件について

2009-01-01T11:45:00+0000

Emacs22では,「→」とかの記号が半角幅で表示されてしまう.

こちらのページに詳しいが,UTF-8には文字幅が文脈依存になる文字があって,矢印とかがまさにそれに当たるとのこと.
以下の内容を.emacsに記載して,どうやら強制的にwide characterとして認識するようにすればいいとのこと.

(utf-translate-cjk-set-unicode-range
 '((#x00a2 . #x00a3)                    ; ¢, £
   (#x00a7 . #x00a8)                    ; §, ¨
   (#x00ac . #x00ac)                    ; ¬
   (#x00b0 . #x00b1)                    ; °, ±
   (#x00b4 . #x00b4)                    ; ´
   (#x00b6 . #x00b6)                    ; ¶
   (#x00d7 . #x00d7)                    ; ×
   (#X00f7 . #x00f7)                    ; ÷
   (#x0370 . #x03ff)                    ; Greek and Coptic
   (#x0400 . #x04FF)                    ; Cyrillic
   (#x2000 . #x206F)                    ; General Punctuation
   (#x2100 . #x214F)                    ; Letterlike Symbols
   (#x2190 . #x21FF)                    ; Arrows
   (#x2200 . #x22FF)                    ; Mathematical Operators
   (#x2300 . #x23FF)                    ; Miscellaneous Technical
   (#x2500 . #x257F)                    ; Box Drawing
   (#x25A0 . #x25FF)                    ; Geometric Shapes
   (#x2600 . #x26FF)                    ; Miscellaneous Symbols
   (#x2e80 . #xd7a3) (#xff00 . #xffef)))

同様の問題はPuTTYとかでも起こるので,UTF-8のシステムに接続する際には「ウィンドウ→変換」の「CJK用の文字幅を使用する」にチェックを入れておくと安心.

このエントリーをはてなブックマークに追加
Bookmark this on Delicious

debian etchのemacsでutf-8を使う

2009-01-01T11:41:00+0000

ようするに,emacs21でUTF-8を使用可能にする.

utf-8対応するには,mule-ucsパッケージをインストールすればよい.

# apt-get install mule-ucs

その上で,.emacsでun-defineをloadするように設定

(require 'un-define)
(set-language-environment "Japanese")
(prefer-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8-unix)
(set-terminal-coding-system 'utf-8-unix)
(auto-compression-mode t)

set-language-environment以下の設定は日本語表示のための設定となるので,すでにEUC-JPを使っている場合は不必要.

このエントリーをはてなブックマークに追加
Bookmark this on Delicious

Konsoleをgnome-terminalチックに使う

2009-01-01T11:06:00+0000

ショートカットとかが大幅に違うKonsoleをgnome-terminalっぽく使うには,”.kde/share/config/konsolerc”を書き換えればよい.よくつかうショートカット(コピー,ペースト,タブ関連)をgnome-terminal同等にするには,以下の内容を追加すればOK.

[Desktop Entry]
defaultfont=M+1VM+IPAG circle,12,-1,5,50,0,0,0,0,0

[Shortcuts]
edit_copy=Ctrl+Shift+C
edit_paste=Ctrl+Shift+V
fullscreen=Alt+F10
new_session=Ctrl+Shift+T
switch_to_session_01=Alt+1
switch_to_session_02=Alt+2
switch_to_session_03=Alt+3
switch_to_session_04=Alt+4
switch_to_session_05=Alt+5
switch_to_session_06=Alt+6
switch_to_session_07=Alt+7
switch_to_session_08=Alt+8
switch_to_session_09=Alt+9
このエントリーをはてなブックマークに追加
Bookmark this on Delicious

タイムゾーンを設定する

2009-01-01T11:02:00+0000

タイムゾーンの設定は/etc/timezoneに保存されている.

が,その設定方法はDebianとUbuntuで異なるので注意.

Debianではtzconfigコマンドで設定する.

# tzconfig

Ubuntuだと,tzdataパッケージの再設定となる.

# dpkg-reconfigure tzdata
このエントリーをはてなブックマークに追加
Bookmark this on Delicious

gzipファイルの読み書き

2009-01-01T10:57:00+0000

リファレンスマニュアルのGzipReaderの項GzipWriterの項参照.

Zlibのライブラリを読み込むことによって,普通のIOと同様にgzipファイルの読み書きをできるようになる.

require 'zlib'

Zlib::GzipReader.open('hoge.gz') do |fin|
  while line = fin.gets
    p line
  end
end

Zlib::GzipWriter.open('moge.gz') do |fout|
  0.upto(9) do |i|
    fout.print i.to_s + "\n"
  end
end
このエントリーをはてなブックマークに追加
Bookmark this on Delicious