代码: 全选
;; 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)