Commit Graph

6 Commits

Author SHA1 Message Date
Edwin Török
e5ff6c8418 fix +format--set error path
In +format--set:
../modules/editor/format/autoload/settings.el:81:26:Warning: ‘error’ called
    with 0 args to fill 1 format field(s)

Signed-off-by: Edwin Török <edwin@etorok.net>
2018-10-04 00:38:05 +01:00
Henrik Lissner
e38e79e6d7
editor/format: fix not-a-function error
Because unquoted lists were being evaluated, it was treated as a
function call.
2018-09-10 08:25:48 -04:00
Henrik Lissner
f6234e463a
editor/format: rewrite set-formatter!
+ First argument is no longer a major mode or list thereof, it is NAME.
  Use :modes instead.
+ Updated docstring & examples.
+ Added formatting unsetting: (set-formatter! 'some-formatter nil)
2018-09-09 09:58:23 -04:00
Henrik Lissner
df42d8ce89
editor/format: rewrite & fix set-formatter!
+ Updated docstring (and added two more examples)
+ Can now be used with shell command strings or string lists. String
  sublists can have more than 2 elements. Non-string items will be
  interpolated into the string before it. If any non-string item is nil,
  its sublist is omitted entirely.
+ Can now be used to redefine formatters predefined by the format-all
  package, by passing the formatter's name (as a symbol) as the first
  argument.
+ Added :modes property for cases when first argument isn't a major mode
  or list of them (when redefining a formatter).
2018-09-03 03:58:44 +02:00
Henrik Lissner
6e03ddacda
Update & revise set-formatter! docstring 2018-08-29 15:56:59 +02:00
Henrik Lissner
4b9233bec7
editor/format: format by diff & major refactor
This redesigns how format-all applies changes. Before, it would erase
the buffer and insert the formatted result. This would throw markers out
of whack, and usually meant the cursor would end up somewhere else (e.g.
the beginning of the file).

Now, changes are made to the buffer line by line, via RCS patch.

Other changes:

+ +format-region function was removed (replaced by +format-buffer and
  +format/region).
+ set-formatter! was moved to autoload/settings.el
+ New +format/buffer command to replace format-all-buffer
2018-08-29 12:48:38 +02:00