gpt4 book ai didi

emacs - 如何在 Emacs 中使用 astyle?

转载 作者:行者123 更新时间:2023-12-04 03:47:24 25 4
gpt4 key购买 nike

我正在使用具有以下规范的 windows emacs。

GNU Emacs 23.0.91.1 (i386-mingw-nt5.1.2600) of 2009-02-26

我希望能够运行 astyle,以便它可以使用键盘命令或菜单重新格式化代码。 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 )

关于emacs - 如何在 Emacs 中使用 astyle?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/801983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com