voxpupuli / puppet-mode

Edit Puppet manifests with GNU Emacs 24
https://github.com/voxpupuli/puppet-mode
GNU General Public License v3.0
90 stars 60 forks source link

Prevent comments from changing the indentation level #113

Closed paran1 closed 6 years ago

paran1 commented 6 years ago

Fixes #110

paran1 commented 6 years ago

I am using this locally and it works for me. However I am not 100% sure this is the right approach, given that it used to work in really old versions of puppet-mode without this (see #110).

However, this is much cleaner than my previous attempt (#105) and might be good enough for now. Nothing prevents somebody from doing something better later.

Drawback is that this does introduce a regression if somebody have comments after an opening curly brace, like this:

class foo { # comment

My guess is that this is very uncommon.

The test case for this is in the first commit and can be merged separately if necessary.