Skip to content

storvik/emacs-astyle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

astyle.el

MELPA CI

Emacs library that provides functions to easily reformat C code using astyle. This library leverages reformatter.el which makes working with formatters a breeze.

Installation

Typical installation using use-package looks like this:

(use-package astyle
  :ensure t
  :when (executable-find "astyle")
  :hook (c-mode-common . astyle-on-save-mode))

c-mode-common-hook is used to enable format on save functionality.

Usage

Formatting can be invoked by running either astyle-buffer or astyle-region. If astyle configuration file is found (customize file name bu editing variable astyle-default-rc-name) it will be prefered. If no configuration file is found either astyle-custom-args or astyle-default-args is used

There are two ways of enabling format on save functionality. Either enable astyle-format-on-save in mode hook or place the following in your project .dir-locals.el:

((c-mode
   (mode . astyle-format-on-save)))

Features

  • Easily customizable with sane defaults.
  • Uses c-basic-offset for indent.
  • Will prefere .astylerc configuration file if present in parent dirs.

About

Wrapper around astyle for formatting C buffers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published