Big Chinese Small ASCII

GNU Emacs有一个假设,即一个汉字字符的宽度是一个ASCII的两倍。如果这个假设不满足,就会有些功能看起来不正常,比如auto-fill-modeorg-mode table。很遗憾,缺省情况下,这个假设并不成立。

查看字体使用C-u C-x =,注意其中xft的值,通常来说,ASCII和中文的字体大小是一样的。以下是我的缺省字体设置:

(custom-set-faces
  ;; custom-set-faces 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.
 '(default ((t (:inherit nil :stipple nil :background "#ffffff"
                :foreground "#000000" :inverse-video nil :box nil
                :strike-through nil :overline nil :underline nil
                :slant normal :weight normal :height 170
                :width normal :foundry "Ascender Corp."
                :family "Liberation Mono")))))

使用如下方法可以将汉字宽度设置为ASCII的两倍,具体数值需要参考相应的缺省配置。

(set-fontset-font "fontset-default" 'chinese-gbk "AR PL UKai CN 20")

如果是Emacs daemon,则需要写成:

(if (and (fboundp 'daemonp) (daemonp))
    (add-hook 'after-make-frame-functions
              (lambda (frame)
                (with-selected-frame frame
                  (set-fontset-font "fontset-default"
                                    'chinese-gbk "AR PL UKai CN 20"))))
  (set-fontset-font "fontset-default" 'chinese-gbk "AR PL UKai CN 20"))

这种方法的缺点是汉字很大、英文较小。

Emacs 23.1 released

Emacs 23.1已经发布,并提供下载。其中最吸引我的是字体和daemon,这也是我此前一直使用CVS Emacs的原因。

然而使用daemon可能会有一点点小麻烦,如果你觉得自己的daemon不正常,可以尝试执行

emacs -Q --daemon

-Q阻止emacs在启动的时候读取用户的定制文件——.emacs。如果这时一切正常了,那么说明你的配置和daemon有些冲突。不幸的是究竟怎样配置才能正常启动daemon目前还不是很清楚,我的两个帖子可以用来参考。