Skip to content

Releases: radian-software/apheleia

Apheleia 4.2

03 Aug 23:23
Compare
Choose a tag to compare

Changes

  • Custom Emacs Lisp formatting functions have the option to report an error asynchronously by invoking their callback with an error as argument. Passing nil as argument indicates that there was no error, as before. The old calling convention is still supported for backwards compatibility, and errors can also be reported by throwing, as normal. Implemented in #204.

Features

  • New user option apheleia-mode-predicates. The default value handles mhtml-mode correctly by always using whatever formatter you have configured for that mode, rather than using css-mode, html-mode, etc formatters depending on the position of point (#302).

Enhancements

  • There is a new keyword argument to apheleia-format-buffer which is a more powerful callback that is guaranteed to be called except in cases of synchronous nonlocal exit. See the docstring for details. The old callback, which is only invoked on success and receives no information about errors, is still supported and will continue to be called if provided. See #204.

Formatters

Bugs fixed

  • The point alignment algorithm, which has been slightly wrong since 2019, has been fixed to more correctly use dynamic programming to maintain the position of point. Also, some cases of a nil pointer error during point alignment have been fixed (#290).
  • apheleia-indent-lisp-buffer updated to apply local variables after calling major-mode. Also includes setting for indent-tabs-mode (#286).
  • Formatter scripts will now work on Windows if Emacs can find the executable defined in the shebang.

Internal

  • Major internal refactoring has occurred to make it possible to write integration tests against Apheleia. This should improve future stability but could have introduced some bugs in the initial version. See #204.
  • Some debugging log messages have changed, see #204.

Apheleia 4.1

26 Feb 02:06
Compare
Choose a tag to compare

Enhancements

  • Use perltidy as default formatter for cperl-mode (#260).
  • The perltidy formatter now supports Emacs indentation and line length settings (#261).
  • Indent level is now determined for graphql-mode, html-mode, ruby-mode, ruby-ts-mode, svelte-mode, and yaml-mode (#258).
  • Indent level support when using yq to format JSON, XML, and YAML (#259).

Formatters

Bugs fixed

  • Apheleia sometimes failed to determine indent level from Emacs settings even when configured to do so. This is fixed (#274).

Apheleia 4.0

23 Nov 22:12
Compare
Choose a tag to compare

Breaking changes

  • The order of entries in apheleia-mode-alist is no longer as important. Specifically, if two different mode entries in apheleia-mode-alist match the current buffer, then the more specific one is used, even if it comes later. This is generally speaking what you would expect to happen. For other cases, such as ordering of regex entries, or modes versus regexes, order is respected as before ([#206]).
  • Disable formatting of go module files with gofmt. This was never supported (#214).
  • Remove support for Emacs 26 (#215).
  • Emacs will infer indentation configuration from your major mode and, by default, supply this configuration to formatters, to ensure consistency between how you have Emacs configured and how your formatter is configured. You can disable this by setting apheleia-formatters-respect-indent-level to nil (#167, #208).

Enhancements

  • Use the prettier-json formatter for js-json-mode (#209).
  • Prettier is now enabled in svelte-mode.
  • More tree-sitter based major modes have been added to apheleia-mode-alist ([#191]).
  • All marks (the current (mark), and the mark-ring) are now adjusted, alongside (point) (#197).
  • Built-in formatters now use a new "apheleia-npx" built-in script instead of the legacy npx keyword. The effect of the new script is the same, except that it also works with Yarn PNP projects as well as node_modules style projects ([#200]).
  • Autoload the apheleia-goto-error command (#215).
  • Use lisp-indent as default formatter for emacs-lisp-mode (#223)
  • Use hclfmt for formatting hashicorp HCL files (#231)
  • The mix format formatter will respect .formatter.exs files even if they are present in a parent directory rather than the same directory as the file being formatted (#232).

Internal Changes

  • Refactored the organisation of the apheleia package for ease of understanding and usability (#215).
  • The new scripts/pnp-bin.js script is standalone minified nodejs built from the pnp-bin repo, extracted from apheleia PR [#200].
  • Test environment bumped from Ubuntu 20.04 to 22.04 (#242).
  • The function apheleia--format-after-save was renamed to apheleia-format-after-save. This is only called out explicitly because it was added to after-save-hook so customization that assumed this behavior might break.

Bugs fixed

  • ktlint would emit log messages into its stdout when formatting, and these would get spliced into the source file. This has been fixed by suppressing all logs from ktlint.
  • Disable colorized output with the jq formatter (#213).
  • Fixed apheleia skipped running a formatter on a remote when it isn't installed locally (#215).
  • Fixed clang-format formatter did not respect remote file-name component for the assumed file-name (#215).
  • Always supply --stdin-filepath to Prettier to allow it to pick up the correct settings from project-level config files (#253).

Formatters

Apheleia 3.2

25 Feb 19:33
Compare
Choose a tag to compare

Features

  • You can use apheleia-inhibit as a file-local variable to disable Apheleia turning on automatically for a file or directory. You can also use apheleia-inhibit-functions to configure custom logic to prevent Apheleia from turning on automatically under certain circumstances, without needing to adjust file-local variables. See #134 and #138.
  • apheleia-mode lighter is now customizable (#143).

Changes

  • shfmt is no longer enabled by default in order to prevent corruption of zsh scripts. Re-enabling shfmt in a future release is intended, but depends on further implementation work in Apheleia to only enable it for supported shells.

Enhancements

  • Emacs 29's tree-sitter-based major modes have been added to apheleia-mode-alist (#145, #148, [#151], [#155]).

Bugs fixed

  • If a formatter exited with a zero exit code when being killed by a signal (even though that is really weird behavior and arguably a bug in the formatter), then if a file was saved multiple times in quick succession, its contents could be erased and replaced with an error message from the formatter. This has been fixed. See #131 for more details.
  • Npx commands in apheleia-formatters are not overwritten when expanding binary path to node_modules directory (#152).
  • Error is no longer reported when the first element of a command is an evaluable form rather than a literal string ([#156]).

Formatters

Apheleia 3.1

12 Nov 03:53
Compare
Choose a tag to compare

Enhancements

  • shfmt uses 4 spaces instead of tabs by default.
  • Formatters using 'filepath (OCamlFormat and Prettier) are no longer prevented from running on a modified buffer (#109, #110).
  • Buffer content is now always passed to formatters using a pipe. This fixes issues with formatters that behave differently when receiving input on stdin versus being run on a tty (#119).
  • Prettier now specifies --parser argument explicitly, so it will work properly even when the name of the file does not match what Prettier expects (e.g. .yamllint will be formatted as YAML by Prettier as long as it is in yaml-mode). See #103.

Bugs fixed

  • When a formatter has a bug and fails to return anything on stdout (e.g. scalafmt), do not erase the buffer (#116).
  • Fix Error: "Selecting deleted buffer" which occurred in some circumstances due to a race condition (#123).
  • Apheleia does not delete the contents of narrowed buffers when running. Instead, it is disabled in narrowed buffers. Support for narrowed buffers may be added in future but it has never been correctly supported in the past (see #43). More at #124, #127.
  • Currently, when a formatter invoked via a process isn't installed correctly; it throws an error. It doesn't make sense to attempt to format if we can't find the correct formatter, so instead formatting is only attempted when the formatter is found. #126
  • clang-format doesn't handle filenames correctly by default. Support for guessing the flags from first the file name then the major mode in the case of a temporary buffer was added in #128
  • Fix handling of formatters using inplace in some circumstances (#132).

Formatters

  • elm-format for Elm (#100).
  • bean-format for Beancount (#101).
  • stylua for Lua (#105).
  • Native Emacs indentation of Emacs Lisp code as a formatter (#102). This is not enabled by default but you can enable it by adding (emacs-lisp-mode . lisp-indent) to apheleia-mode-alist

Bugfixes

  • Prettier supports SCSS instead of SASS. The original support for SASS in Apheleia was a bug because Prettier actually never had support for SASS in the first place, so Apheleia would have failed anyway on trying to format a SASS file.

Apheleia 3.0

01 Jun 17:38
Compare
Choose a tag to compare

Breaking changes

  • The arguments of formatters defined as Elisp functions has changed. A formatter function should now be a cl-defun taking key-value arguments with support for more keys being provided on a later apheleia release (by including &allow-other-keys in the parameter list). For a list of provided arguments see apheleia--run-formatter-function.
  • Emacs 25 is no longer supported.

Enhancements

  • Ocamlformat is now used in caml-mode in addition to tuareg-mode (#94).

Formatters

Features

  • Support remote files and buffers that were opened through TRAMP (#33).

Apheleia 2.0

10 Apr 20:55
Compare
Choose a tag to compare

Breaking changes

  • The interface to apheleia-format-buffer has changed. You now pass in the symbol of a formatter from apheleia-formatters (or a list of them) rather than the actual command. This change improves the ability of Apheleia to report useful error messages and logging.
  • Stdout and stderr buffers are no longer retained after running a formatter. Instead, the stderr is appended into an *apheleia-cmdname-log* buffer if it fails, or unconditionally if the new user option apheleia-log-only-errors is set to nil. See #64, #65. The log buffer is not hidden by default, unlike the old stdout and stderr buffers, but this can be changed with the new user option apheleia-hide-log-buffers. Also, the log shows all command output rather than just the latest run. You can add further customizations using the new hook apheleia-formatter-exited-hook (#69).

Features

  • Apheleia can now format buffers that do not have an underlying file (#52).
  • You can now use a Lisp function as a formatter, by providing a symbol or lambda in apheleia-formatters rather than a list of strings (#62).
  • Formatters that operate on files in place are now supported, by using the symbol inplace in an entry on apheleia-formatters to stand in for the name of a temporary file that will be modified in place by the formatter (#23).

Enhancements

  • The buffer-local variable apheleia-formatter is now marked as safe (#74). This allows you to configure the formatter that Apheleia will use in a file-local variable. Note: only formatters already declared in apheleia-formatters can be used; this does not allow arbitrary shell commands to be specified in file-local variables.

Bugs fixed

  • Allow running the same formatter in multiple buffers in parallel (#64, #65). Previously, when saving a number of files at the same time, the contents of those buffers could be corrupted by a race condition.
  • In some circumstances the error wrong-type-argument bufferp nil could be reported when running certain formatters under Apheleia. This has been fixed.
  • Rustfmt is no longer passed the --unstable-features and --skip-children flags, since they are not available on all versions of Rustfmt (#69).
  • When a formatter cannot be found, orphaned stderr processes are no longer created and left around forever (#47).
  • Apheleia no longer resets the major mode to its default value when formatting a buffer. This was never intended and the bug has now been fixed (#58).

Formatters added

Formatter bugs fixed

  • isort is passed different arguments so as not to trigger a crash that appears to be related to the --stdout flag.
  • latexindent now has its log file disabled so as to avoid cluttering the working directory.
  • ocamlformat is now configured to work even outside of detected projects.

Apheleia 1.2

28 Dec 04:32
Compare
Choose a tag to compare

Enhancements

  • Support multiple formatters (#31). You can now configure a list of formatters for a major-mode in apheleia-mode-alist and they will be run in sequence.
  • Support evaluating items in apheleia-formatters to make formatter commands more dynamic (#50, #55).

Formatters

Bugs fixed

  • Fix spelling error in generated process names (#32).
  • Apheleia no longer conflicts with undo-fu (#39).
  • Apheleia no longer triggers after-set-visited-file-name-hook, which reduces conflicts with various modes. For example, lsp-mode will no longer trigger a reconnect every time you save.
  • Fix inconsistent :type spec preventing use of customize-variable on apheleia-formatters.
  • Fix mixed style line ending generated by diff (#54) by adding --strip-trailing-cr to diff's argument list.

Apheleia 1.1.2

27 Feb 06:05
Compare
Choose a tag to compare

Enhancements

  • Prettier is now enabled in json-mode.

Bugs fixed

  • Prettier now respects .prettierignore (#21).
  • Apheleia's global mode should no longer trigger warnings about a locally let-bound after-save-hook (#27).

Apheleia 1.1.1

16 Jul 14:27
Compare
Choose a tag to compare

Formatters

Bugs fixed

  • Previously, there were some race conditions related to switching the current buffer. In particular, if you switched the current buffer right after saving, or save two buffers in quick succession, then it was possible for one buffer to be overwritten or to not be formatted. These problems have been fixed (#8).
  • Previously, enabling undo-tree-auto-save-history caused Apheleia to mark the buffer as modified after formatting. This has been fixed (#10).
  • Apheleia now tries harder to accidentally enter an infinite formatting loop (#12).