8
我使用的Windows emacs的規格如下。如何在Emacs中使用astyle?
GNU Emacs的23.0.91.1的2009-02-26
我希望能夠運行的astyle,因此它可以通過一鍵格式化代碼(I386-MinGW的-nt5.1.2600)命令或菜單。 emacs中有什麼其他的等價物?
我使用的Windows emacs的規格如下。如何在Emacs中使用astyle?
GNU Emacs的23.0.91.1的2009-02-26
我希望能夠運行的astyle,因此它可以通過一鍵格式化代碼(I386-MinGW的-nt5.1.2600)命令或菜單。 emacs中有什麼其他的等價物?
像這樣的東西可能會做:
(defun astyle-this-buffer (pmin pmax)
(interactive "r")
(shell-command-on-region pmin pmax
"astyle" ;; add options here...
(current-buffer) t
(get-buffer-create "*Astyle Errors*") t))
這將運行在選定區域中「的astyle」命令。
或者,你可以簡單地使用emacs內置的代碼格式化通過鍵入類似
C-x h C-M-\
(即選擇整個緩衝區和運行indent-region
)
`縮進region`甚至還沒有接近與astyle相提並論。它只會縮進並不會重新格式化代碼(即正確的多餘的括號之間的空白,不會正確放置括號和parens等等) – dom0 2013-11-26 14:39:39