How do I use astyle within Emacs?

后端 未结 1 1464
借酒劲吻你
借酒劲吻你 2020-12-31 12:45

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

1条回答
  •  再見小時候
    2020-12-31 13:24

    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)

    0 讨论(0)
提交回复
热议问题