I am using windows emacs with specifications below.
GNU Emacs 23.0.91.1 (i386-mingw-nt5.1.2600) of 2009-02-26
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?
Something like this might do:
(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))
This will run the "astyle" command on the selected region.
Or, you could simply use emacs' built-in code formatting by typing something like
C-x h C-M-\
(I.e. select the whole buffer and run indent-region
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With