EMACS下存盘时自动转换TAB,去除多余空格(小技巧)

Vim、Emacs配置和使用
回复
reedarx
帖子: 4
注册时间: 2007-11-29 19:46

EMACS下存盘时自动转换TAB,去除多余空格(小技巧)

#1

帖子 reedarx » 2007-11-29 20:09

这个对我很有用,不知对大家是否有用。粘贴到你的~/.emac文件即可。

代码: 全选

;; 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
        ;;(basic-save-buffer)
)

;; Add-hook to automate the task when we save files
(add-hook 'write-file-hooks 'reed_update_file)
Lave
帖子: 35
注册时间: 2007-11-29 19:33

#2

帖子 Lave » 2007-11-30 7:05

支持,不过对我没有用处.
HP Compaq 6515b+Linux+Ubuntu+Sawfish+Emacs+Firefox...
郑尧
帖子: 65
注册时间: 2007-07-29 16:09

#3

帖子 郑尧 » 2007-12-11 16:14

搂主主要应该是写tex时用吧
回复