There are times when I'm editing files (Puppet manifests, for example) where I want to align buffer contents on the fly. For example, I know that I can use align-regexp
or align
to align code like this, as long as I have it selected:
# M-x align-regexp "=>" will line everything up nicely
file { "/etc/foo":
ensure => present,
mode => "0666",
source => "puppet:///modules/example/foo",
}
But what I really want is to have this happen on the fly -- without having to select a region or the whole buffer. Is there a package or mode that will do this, or is this something that would have to be built in to the mode I'm interested in?
Edit: I asked about Puppet and CFEngine, since that's what I code in most these days and I have a strong preference for aligned text. However, I was also curious (and did not express this well) to know if on-the-fly alignment is a feature that's common in Emacs modes (mainly in modes for programming languages), or if most people align when saving or at some other point.