在SUN已经快两年了,早就有人跟我说,如果你想成为资深(Senior)工程师,就得抛弃Windows那一套东西,以前没当回事,随着时间的推移,越来越感觉使用Windows那一套开发工具,很不方便。

看着SUN大部分资深工程师都是直接使用EMACS/VIM,如是就试了试XEMACS。发觉果然不错,你可以完全定制它,使他完全符合你的习惯,另外他在各种平台下的表现都是一致的。只可惜自己醒悟的太晚。

下面的一段脚本是我试验了半天得出来的结果:主要目的是在文件存盘时,自动尽可能将空格转换成为TAB键,然后自动删除行尾多余的空格。如果是EMACS,你可以将其放到~/.emacs.el,如果是XEMACS,你可以将其放到~/.xemacs/init.el

...

;; Add save buffer hook
(defun reed_update_file()
        "Convert spaces to tabs, and remove useless spaces"
        (interactive)

        ;; Remove useless spaces
        (edit-picture)
        (picture-mode-exit)

        ;; Convert spaces to tabs
        (tabify (point-min) (point-max))

        ;; Save buffer
        (continue-save-buffer)
)

;; Add-hook to automate the task when we save files
(add-hook 'write-file-hooks 'reed_update_file)

...

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by reed