editor/reformat: refactor & fixes

+ Change +format-type to +format-region-p (now a boolean)
+ Add PRESERVE-INDENT-P boolean argument to +format-buffer
+ Add +format-preserve-indentation variable (only controls indent
  preservation during +format/buffer, not +format/region, where it's
  always enabled).
+ Fix error arising from +format|buffer hook when no formatter is
  defined for the current mode #893
+ Change +format|buffer to alias for +format/buffer.
This commit is contained in:
Henrik Lissner 2018-09-18 13:14:39 -04:00
parent f4e119a642
commit 6a44cf0124
3 changed files with 74 additions and 61 deletions

View file

@ -12,6 +12,12 @@ If nil, it is disabled in all modes, the same as if the +onsave flag wasn't
Irrelevant if you do not have the +onsave flag enabled for this module.")
(defvar +format-preserve-indentation t
"If non-nil, the leading indentation is preserved when formatting the whole
buffer. This is particularly useful for partials.
Indentation is always preserved when formatting regions. ")
(defvar-local +format-with nil
"Set this to explicitly use a certain formatter for the current buffer.")