B166Er 的窝

Happy coding

XFCE4中自动挂载的乱码问题

昨天在研究linux下的音乐播放软件的时候,突然意识到一个重大的问题:我的活动硬盘在XFCE下竟然中文文件名全都是问号。以前也曾经想过这个问题, 当然,一种简单的解决方式就是修改/etc/fstab,在里面加上相应的设备,以及它的uft8支持。但是...现在的linux不会这么蠢吧?!如果 我有100个移动设备,难道还要对每个都添加相应的项到/etc/fstab里吗?

一通 google 之后得知,HAL(hardware abstract layer)可以识别插入的移动设备,并要求系统自动挂载(大概就是这样吧,具体的原理不晓得,所以说错了请大家包涵:))。接下来又是一通 google,心情也随搜索结果的变化而变化....大体过程不说了,最后的结果是:对于 xfce4,现有的thunar就是不能识别中文,需要一个补丁。这个补丁是打在 exo-mount 上的 (这是 gnome-mount的替代物,但是竟然没有考虑 hal 中的挂载选项,天知道xfce的人是怎么想的!)。

不论如何,补丁有:
https://bugzilla.altlinux.org/attachment.cgi?id=2029&action=diff
这里有一个更简单的,我没试过。。。
http://rinoworks.blogspot.com/2007/11/xfce-44.html
源代码也有:

http://thunar.xfce.org/pwiki/documentation/installation


注 意,exo-mount是一个可执行文件,在 exo-VERSION这个包里。所以,直接打包,编译,安装exo-VERSION 这个包就可以....过程如thunar的wiki上所述。(./configure的过程会提示缺少什么开发包,直接apt-get即可,注意包的名称 可能是:libPKGNAME-dev之类的。如果 ./configure --prefix="/usr/local",则最后会装到 /usr/local/bin下,不过系统似乎会对local下的程序优先执行之....)

当然,光这样还不行,得修改 HAL 的“策略”,debian 中相应的是这个文件:/etc/hal/fdi/policy/preference.fdi。留个备份然后改之(网上的帖子五花八门,有的说不用改这 个,直接 在gconf-edit中加一个string就可以了,可是我这里的纯xfce系统似乎没有这个相应的项,因此更确定了去修改Hal的策略)合适位置加上 下面这些:

<device>
<!--dmask=000,fmask=111 will make directories accessible to all, while files will stay non-executable -->
<match key="volume.fstype" string="ntfs">
<append key="volume.mount.valid_options" type="strlist">dmask=000</append>
<append key="volume.mount.valid_options" type="strlist">fmask=111</append>
</match>
</device>

<device>
<!-- Use UTF-8 charset for vfat -->
<match key="volume.fstype" string="vfat">
<merge key="volume.policy.mount_option.iocharset=utf8" type="bool">true</merge>
</match>
</device>

<device>
<match key="storage.hotpluggable" bool="false">
<match key="storage.removable" bool="false">
<merge key="storage.automount_enabled_hint" type="bool">false</merge>
</match>
</match>
</device>

然后

sudo /etc/init.d/hal stop
sudo /etc/init.d/hal start


就行啦。

注意到 Hal 的网站上好像还有针对 ipod的策略,以后如果有了 ipod 再想自动挂载它吧!当然,还可以用 checkinstall 生成一个exo的debian包,这样下次坏了就不用重新编译exo啦,这正是我刚才做的事。。。

Emacs-snapshot-gtk (emacs23) 字体设置

参考:

Emacs23字体优化 ease.blogbus.com/logs/8041520.html

Pretty Emacs  http://peadrop.com/blog/2007/01/06/pretty-emacs/

配置文件.emacs,仅设置了中文字体和texlive:

;;设置中文字体
(set-fontset-font (frame-parameter nil 'font)  'han '("WenQuanYi Bitmap Song" . "unicode-bmp"))

;;启动LaTeX设置
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

;;使用颜色主题
(require 'color-theme)
(if window-system
    (if (> (caddr (decode-time (current-time))) 18)
        (color-theme-arjen)             ;白天光线好用黑色系的主题
      (color-theme-deep-blue))          ;晚上光线差用深蓝系的主题
;;(color-theme-tty-dark)
)