如何在 Emacs 中使用 astyle? [英] How do I use astyle within Emacs?
本文介绍了如何在 Emacs 中使用 astyle?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用具有以下规格的 windows emacs.
I am using windows emacs with specifications below.
GNU Emacs 23.0.91.1 (i386-mingw-nt5.1.2600) of 2009-02-26
我希望能够运行 astyle,以便它可以使用键盘命令或菜单重新格式化代码.emacs 中的其他等价物是什么?
I want to be able to run astyle so it can reformat the code by using a key command or menu. What is some other equivalent in 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"命令.
This will run the "astyle" command on the selected region.
或者,您可以通过键入类似的内容来简单地使用 emacs 的内置代码格式
Or, you could simply use emacs' built-in code formatting by typing something like
C-x h C-M-
(即选择整个缓冲区并运行indent-region
)
(I.e. select the whole buffer and run indent-region
)
这篇关于如何在 Emacs 中使用 astyle?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文