From ca24c90705c35372624fd74f66526191f103929f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 26 Nov 2023 12:26:00 +0200 Subject: [PATCH] Add perltidy indent level and line length support --- CHANGELOG.md | 5 +++++ apheleia-formatters.el | 4 +++- apheleia-utils.el | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8871d12b..94ebe964 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog]. ## Unreleased +### Enhancements +* The `perltidy` formatter now supports Emacs indentation and line length + settings ([#261]). + ### Formatters * [`js-beautify`](https://github.com/beautify-web/js-beautify) for [JavaScript](https://www.javascript.com/), @@ -15,6 +19,7 @@ The format is based on [Keep a Changelog]. ([#263]). [#229]: https://github.com/radian-software/apheleia/pull/229 +[#261]: https://github.com/radian-software/apheleia/pull/261 [#263]: https://github.com/radian-software/apheleia/pull/263 ## 4.0 (released 2023-11-23) diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 780da69d..8c84a1e6 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -83,7 +83,9 @@ (ocamlformat . ("ocamlformat" "-" "--name" filepath "--enable-outside-detected-project")) (ormolu . ("ormolu")) - (perltidy . ("perltidy" "--quiet" "--standard-error-output")) + (perltidy . ("perltidy" "--quiet" "--standard-error-output" + (apheleia-formatters-indent "-t" "-i") + (apheleia-formatters-fill-column "-l"))) (pgformatter . ("pg_format" (apheleia-formatters-indent "--tabs" "--spaces" 'tab-width) (apheleia-formatters-fill-column "--wrap-limit"))) diff --git a/apheleia-utils.el b/apheleia-utils.el index 2f9c92e8..5e8b3649 100644 --- a/apheleia-utils.el +++ b/apheleia-utils.el @@ -35,6 +35,7 @@ always returns nil to defer to the formatter." (unless indent-var (setq indent-var (cl-case major-mode + (cperl-mode 'cperl-indent-level) (css-mode 'css-indent-offset) (css-ts-mode 'css-indent-offset) (js-jsx-mode 'js-indent-level) @@ -47,6 +48,7 @@ always returns nil to defer to the formatter." (json-ts-mode 'json-ts-mode-indent-offset) (nxml-mode 'nxml-child-indent) (robot-mode 'robot-mode-basic-offset) + (perl-mode 'perl-indent-level) (scss-mode 'css-indent-offset) (web-mode 'web-mode-indent-style) (tsx-ts-mode 'typescript-ts-mode-indent-offset)