Thursday, May 17, 2007

Unicad 0.65

Unicad.el FAQ


project address: http://code.google.com/p/unicad/

What is Unicad?

Unicad is short for Universal Charset Auto Detector. It is an Emacs-Lisp port of Mozilla Universal Charset Detector.

What can Unicad do?

Unicad helps Emacs to guess the correct coding system when opening a file.

What languages and coding systems does Unicad support?

  • Chinese Simplified (gb18030, gbk, gb2312, hz-gb-2312, iso-2022-cn)
  • Chinese Triditional (big5, gb18030, gbk, euc-tw)
  • Japanese (sjis, euc-jp, iso-2022-jp)
  • Korean (euc-kr, iso-2022-kr)
  • Greek (iso-8859-7, windows-1253)
  • Russian (iso-8859-5, windows-1251, koi8-r, ibm855)
  • Bulgarian (iso-8859-5, windows-1251)
  • Western European (latin-1)
  • Central European (latin-2)

Who should use Unicad?

1. Emacs Users. Unicad is an Emacs extension that written in Elisp. It is designed and works for Emacs.

2. Multilanguage Users. If you are English only speakers, then there is no need to install Unicad on Emacs. Otherwise, if you need to read and edit files in multiple language and use different coding systems, Unicad will definitely help you in recognizing coding systems.

3. Anyone who is tired of struggling with garbled text. Normal Text Editors are not so intelligent to choose correct coding system among various and complicated charsets. I suggest you try the most powerful text editor ever in the world - Emacs and Unicad.

How to use Unicad?

Download the latest unicad.el, copy it to your Emacs load path (e.g. site-lisp directory), and add the following line to your ~/.emacs:

(require 'unicad)

You may byte compile this file to speed up the charset detecting process.

What's the difference between Unicad and Mozilla Universal Charset Detector?

  • optimized for detecting shorter text files.
  • add support for Central European Languages, which use iso-8859-2 coding system.
  • add support for Traditional Chinese that uses gbk coding system.
  • add support for single byte only katakana that uses sjis coding system.


Thursday, May 10, 2007

为什么我偏爱 Emacs

为什么我偏爱 Emacs

在Windows下我通常只使用 Emacs (NTEmacs),用TotalCommander的F3快速查看文 件;在Linux下也基本用 Emacs,用 Vim 修改单个文件。Emacs和一般编辑器相比 到底有什么优点呢?尤其是和UltraEdit,EditPlus等等这样的所谓主流的Win32编辑器相比。

免费并且开源

虽然盗版满天飞,但是如果是工作的人用盗版软件做和工作相关的开发任务还是 不合适的。

全定制

包括外观,配色,字体,不同的中英文字体,编码,模式,快捷键,自建函数等 等一切都是可定制的,这种自由感是在win32软件里体会不到的。

解放鼠标

在噼里啪啦码字的过程中,如果还有伸手去找鼠标是很不爽的事。既然不需要鼠 标了,菜单栏,工具栏这些也都不需要了,这样可以同时扩大可视面积。在分辨 率有限的情况下看到更多有用的信息。

随意分割窗口

在 Emacs 里,可以任意分割窗口,可以水平分割,可以垂直分割,可以先水平分 割再垂直分割。还可以在2个或更多的窗口中看同一个文件。这对于编辑长文件是 很有用的,经常需要看同一个文件不同部分。

更好的选定方式

在 Win32 软件里,选定区域是一种连续的操作,稍不当心就得重新选过,如果 区域开头差了一个字,又得重新选了。

在 Emacs 里的 mark 完全是一种全新的体验。在定好 mark 头之后可以用各种 方式移动,比如用 isearch 来更快的定位。还可以用 C-x C-x 交换 mark 和 point 的位置,调整选定的区域。

在你进行了复制或者调整缩进的操作之后,还可以用 C-x C-x 再次高亮前一次 选中的区域。

列操作

我总是不能理解为什么老有人说UE的列操作多么优秀,却不见有什么例子以显示 哪些列操作是UE独有的。事实上我就觉得 Emacs 的列操作要方便得多。Emacs里 面根本不需要特殊的列模式。你可以像往常一样选中区域然后用列复制,列删除 等等命令就可以了。

dired 模式

可以把它看作一个 Emacs 文件管理器,在 dired-mode 里浏览文件,打开文件, 新建文件夹,改名等等。说起修改文件名,在 dired 里使用 wdired 配合列操作, 宏,正则表达式,这恐怕最方便的批处理改名软件了。比如一个文件夹里有20集 TV,名字是 Friends - s02e01 - TOW xxxx.avi 之类的,然后又从别处下载了 40个字幕文件,文件名是 0201.en.srt 0201.cn.srt 之类的,如何把字幕文件名 改为和相应的视频文件名呢?难道一个一个复制粘贴?如果有10季一共两百多集 怎么办?这时候宏和列操作就是最方便的了。只要定义一次宏,然后运行20次就 搞定了。切身体验,我觉得比Totalcommand 的批处理重命名还要好用。UE里面有 吗?

Do What I Mean (dwim)

这是个很有意思的功能,Emacs 会自动猜测你想要做什么,用一个命令,或者一个快捷键就能完成好多操作。比如 comment-dwim (M-;),在代码中如果没有选中区域,就是在这一行后面加上注释;如果选中一块区域,就会注释一块区域;如果选中的这块区域已经都是注释了,那就是反注释这块区域。

集成 shell

M-x eshell 可以启动 Emacs shell,方便的调试程序,运行脚本,文件管理等 等 command line 能做的事。

相关链接: