Malabarba / aggressive-indent-mode

Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
850 stars 36 forks source link

Strange alternating indentation of vertical keyword lists #122

Closed equwal closed 5 years ago

equwal commented 5 years ago

In Common Lisp, you often want to have a long vertical keyword list, such as in the :export portion of defpackage. This suggests an arrangement such as the following:

(defpackage :example
  (:use :cl)
  (:export :thing1
           :thing2
           :thing3

However, aggressive-indent-mode chooses an indentation method that seems nonsensical (though I may be unaware of another case where this makes sense, I suspect it is accidental):

(defpackage :example
  (:use :cl)
  (:export :thing1
   :thing2
           :thing3
    :thing4
           :thing5))

So we have this alternating behaviour. Of course I can do it like this:

(defpackage :example
  (:use :cl)
  (:export
   :thing1
   :thing2
   :thing3))

though that isn't idiomatic. Thank you!

Malabarba commented 5 years ago

Hi there,

Actually, aggressive-indent doesn't really "choose" an indentation method. It simply applies the indentation functions configured by the major mode.

If you disable aggressive-ident, and then select the whole region and call M-x indent-region, do you get the same behaviour?

equwal commented 5 years ago

If you disable aggressive-ident, and then select the whole region and call M-x indent-region, do you get the same behaviour?

Yes, I'll have to find out where lisp-mode's indentation is implemented and submit my issue there. Thank you.