dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

README.md (2374B)


      1 aggressive-indent-mode [![Melpa](http://melpa.org/packages/aggressive-indent-badge.svg)](http://melpa.org/#/aggressive-indent) [![Melpa-Stable](http://stable.melpa.org/packages/aggressive-indent-badge.svg)](http://stable.melpa.org/#/aggressive-indent)
      2 ======================
      3 
      4 `electric-indent-mode` is enough to keep your code nicely aligned when
      5 all you do is type. However, once you start shifting blocks around,
      6 transposing lines, or slurping and barfing sexps, indentation is bound
      7 to go wrong.
      8 
      9 **`aggressive-indent-mode`** is a minor mode that keeps your code **always**
     10 indented. It reindents after every change, making it more reliable
     11 than `electric-indent-mode`.
     12 
     13 ### Demonstration ###
     14 
     15 - An example of Lisp mode (Emacs Lisp):
     16 ![Lisp Code Example](lisp-example.gif)
     17 
     18 - An example of non-Lisp mode (C):
     19 ![C Code Example](c-example.gif)
     20 
     21 ### Instructions ###
     22 
     23 This package is available from Melpa, you may install it by calling
     24 
     25     M-x package-install RET aggressive-indent
     26 
     27 Then activate it with
     28 
     29     (add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)
     30     (add-hook 'css-mode-hook #'aggressive-indent-mode)
     31 
     32 You can use this hook on any mode you want, `aggressive-indent` is not
     33 exclusive to emacs-lisp code. In fact, if you want to turn it on for
     34 every programming mode, you can do something like:
     35 
     36     (global-aggressive-indent-mode 1)
     37     (add-to-list 'aggressive-indent-excluded-modes 'html-mode)
     38 
     39 #### Manual Installation ####
     40 
     41 If you don't want to install from Melpa, you can download it manually,
     42 place it in your `load-path` along with its dependency `cl-lib` (which
     43 you should already have if your `emacs-version` is at least 24.3).
     44 
     45 Then require it with:
     46 
     47     (require 'aggressive-indent)
     48 
     49 ### Customization ###
     50 
     51 The variable `aggressive-indent-dont-indent-if` lets you customize
     52 when you **don't** want indentation to happen.
     53 For instance, if you think it's annoying that lines jump around in
     54 `c++-mode` because you haven't typed the `;` yet, you could add the
     55 following clause:
     56 
     57     (add-to-list
     58      'aggressive-indent-dont-indent-if
     59      '(and (derived-mode-p 'c++-mode)
     60            (null (string-match "\\([;{}]\\|\\b\\(if\\|for\\|while\\)\\b\\)"
     61                                (thing-at-point 'line)))))
     62 
     63 ## Contribute ##
     64 
     65 [![Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.1.3/dist/gratipay.png)](https://gratipay.com/Malabarba)