Emacs代码缩进

从外面拷贝代码到自己的程序时,需要调整代码缩进格式符合自己需求。下面这段程序可以实现这个功能。

;;格式为规定代码缩进
(defun iwb ()
  "indent whole buffer"
  (interactive)
  (delete-trailing-whitespace)
  (indent-region (point-min) (point-max) nil)
)

(global-set-key [(control c)(control j)]  'iwb)