Commit graph

265 commits

Author SHA1 Message Date
Radon Rosborough
c073299a56 [#52] Fix handling of non-file buffers 2022-01-04 20:57:39 -08:00
Radon Rosborough
4da2898ffd Fix broken handling of filepath 2022-01-04 20:51:29 -08:00
Radon Rosborough
cbffa9298c [#23] Support in-place formatters 2022-01-04 16:21:10 -08:00
Radon Rosborough
826d462bd5 [#47] Clean up stderr processes 2022-01-04 16:08:28 -08:00
Radon Rosborough
6b8d794188 [#20] Document 65,536-char issue 2022-01-04 16:01:28 -08:00
Radon Rosborough
a7e1b82777 [#46] Add apheleia-goto-error 2022-01-04 15:56:12 -08:00
Radon Rosborough
38fb69019f [#69] More logging improvements, new hook 2022-01-04 15:32:38 -08:00
Radon Rosborough
54844c3988 [#69] Improvements to Apheleia logging
* Rename apheleia-hide-log-buffer to apheleia-hide-log-buffers.
* Rename apheleia-verbose to apheleia-log-only-errors (note, meaning
  is inverted).
* Add apheleia-hide-old-log-entries.
* Include more information in log and format it more neatly.
* Convert log buffer to special-mode and attempt to keep point at the
  end (although this is not working for an undetermined reason).
2022-01-03 20:12:52 -08:00
Radon Rosborough
a606d59c2d Port longlines checker from CTRLF 2022-01-03 20:07:29 -08:00
Radon Rosborough
e1dbc1b1c0 [#68] Add fish-indent 2022-01-02 16:51:44 -08:00
Radon Rosborough
38fb75d6c8 Alphabetize 2022-01-02 16:50:26 -08:00
Radon Rosborough
d3304b018c Fix rustfmt, show log by default 2022-01-02 16:41:20 -08:00
Radon Rosborough
6449a7439e Fix broken links 2021-12-29 16:14:54 -08:00
Justin Smestad
73f8d39e4c
Update CHANGELOG.md (#67) 2021-12-29 16:13:28 -08:00
Radon Rosborough
cb8823dab7 Merge tag 'v1.2' 2021-12-27 20:23:35 -08:00
Radon Rosborough
443f5aeb1a Release version 1.2 2021-12-27 20:21:35 -08:00
Radon Rosborough
f0309b17bb [#60] Get coding-system from stdin conditionally 2021-12-27 12:35:58 -08:00
Mohsin Kaleem
2e98165137
[#62] Support functions as formatters (#63)
* [#62] Support functions as formatters

Closes #62.

Lets you use a lisp function as a formatter. This gives apheleia a lot
more flexibility in regards to what constitutes a formatter. For example
you can now plug an external language server or another tool as a
formatter for use with apheleia.

Here's a very basic example of using indent-line-function with apheleia
after merging this commit. Note: this doesn't take into account any
special local variables in the original buffer such as lisp-body-indent.
It's really just for demonstration purposes and as a proof of concept.

```lisp
(defun apheleia-indent-region+ (orig scratch callback)
  (with-current-buffer scratch
    (setq-local indent-line-function
                (buffer-local-value 'indent-line-function orig))
    (indent-region (point-min)
                   (point-max))
    (funcall callback scratch)))

(push '(indent-region . apheleia-indent-region+) apheleia-formatters)
(push '(elisp-mode . indent-region) apheleia-mode-alist)
(push '(lisp-interaction-mode . indent-region) apheleia-mode-alist)
```

* Fix misc-bugs + prevent race conditions

* Update docstring

* Reword a bit

* Add to README

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-12-27 10:00:21 -08:00
Mohsin Kaleem
e700c78a5d
Run the same formatter in multiple buffers in parallel (#64) (#65) (#65)
* Run the same formatter in multiple buffers in parallel (#64) (#65)

Previously when apheleia formatted a buffer it created a stdout and
stderr buffer for each formatter, but it reused this buffer each time
that formatter would run. This makes sense if we only ever format one
buffer at a time (meaning we don't format a new buffer until the
previous buffer has been formatted) such as when calling
`apheleia-format-buffer` interactively (since the interval for running a
formatter is likely far below hitting a key combination for this
command). But this assumption falls apart when using `apheleia-mode` and
`apheleia--format-after-save`.
Now a lot of files could be saved, triggering the same formatters again
and again, within a short period of each other. Apheleia used to keep
track of the current formatter process and kill it when a newer
formatter is attempted, but this also kills all but the last buffer
called by `apheleia--format-after-save`.

With this commit we still have separate stdout and stderr buffers for
each formatter, but we *always* create a new one when attempting a
format. There is a new buffer type, a log buffer, which is populated
with a formatter processes stderr when it fails. We also still have a
`apheleia--current-process` variable, but instead of being global, it's
local to the current buffer being formatted. We now kill it if starting
a new format in the current buffer, but two separate buffers can call
the same formatter with no issue.

* Mark change as bugfix in changelog

* Add to docstring

* Remove no longer needed code

* Re-wrap docstring

* Remove newline

* Change spelling

* Use correct buffer when checking (buffer-size)

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-12-26 12:52:52 -08:00
Mohsin Kaleem
2cf903e9a2
Support non-file buffers (#52) (#59)
* Support non-file buffers (#52)

Closes #52

* Apply suggestions from code review

* Oops, my bad

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-11-21 10:45:50 -08:00
Radon Rosborough
8e0605cc29 [#58] Don't run clang-format in php-mode 2021-11-15 17:32:48 -08:00
Radon Rosborough
b71a5f615a [#57] Document inclusion on MELPA 2021-11-07 09:58:43 -08:00
Radon Rosborough
5b36008ed6 Enable clang-format in c++-mode too 2021-11-04 20:56:14 -07:00
Mohsin Kaleem
1b7f2cf996
Evaluate any non-special args in apheleia-formatters (#55) (#56)
* Evaluate any non-special args in apheleia-formatters (#55)

Allows you to place snippets of elisp within a formatter command that
will be evaluated and substituted in place when apheleia decides to run
that command.

* Update apheleia.el

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-10-31 10:57:44 -07:00
Asif Mahmud Shimon
0c88ad95b8
strip trailing CR (#54)
* strip trailing CR

* updated changelog for pr #54

Co-authored-by: Asif Mahmmud Shimon <shimon.technext@gmail.com>
2021-10-31 10:55:26 -07:00
Mohsin Kaleem
1bf7db7477
Support multiple formatters (#31) (#51)
* Support multiple formatters (#31)

Closes #31

This commit makes it so apheleia can run multiple formatters one after
the other and use the resultant output to format the current buffer.
This works somewhat like a pipeline. The output of one formatter becomes
the input to the next formatter until all formatters have run and then
an RCS patch is built from the resultant output and applied to the
current buffer.

Note: For convenience we internally represent the users configuration as
a list of formatters even when it may only be one. For example if the
user has configured `(python-mode . black)` in apheleia-mode-alist then
internally we interpret that as a formatter list of `(black)` instead of
`black` as we did previously.

* Support multiple formatters (#31)

Closes #31

This commit makes it so apheleia can run multiple formatters one after
the other and use the resultant output to format the current buffer.
This works somewhat like a pipeline. The output of one formatter becomes
the input to the next formatter until all formatters have run and then
an RCS patch is built from the resultant output and applied to the
current buffer.

Note: For convenience we internally represent the users configuration as
a list of formatters even when it may only be one. For example if the
user has configured `(python-mode . black)` in apheleia-mode-alist then
internally we interpret that as a formatter list of `(black)` instead of
`black` as we did previously.

* Make some changes

* Make some changes

* Error when a (not-first) formatter uses file or filepath

* Prevent formatter recieving stdin when using `file'

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-10-24 18:28:18 -07:00
Justin Smestad
8b9d576f2f
Add prettier-ruby (#49)
Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-10-03 11:18:03 -07:00
Justin Smestad
a1e8462dd3
Elixir support (#48)
* Add elixir formatter

* Fix format for elixir to use stdout

* Add CHANGELOG entry
2021-10-03 11:10:22 -07:00
Aleksandar Dimitrov
f46d65c179
Fix rustfmt dumping child modules' content into file (#45)
* Fix rustfmt dumping child modules' content into file

rustfmt by default analyses all files dependent on the current file,
too. The out put of --emit stdout contain all child modules. Apheleia
would happily dump that into the currently edited buffer (even though
the content came from another file.)

The unstable option --skip-children prevents that. It's as yet
untested! I've only made a couple of quick sanity checks.

* Fix long line
2021-10-03 11:09:38 -07:00
Radon Rosborough
92c0fce6b4 [#16] Address package-lint issue 2021-09-26 12:16:04 -07:00
PrimaryCanary
8e022c67fe
[DRAFT] More formatters (#24)
* Add Rust formatter rustfmt.

* Add LaTeX formatter latexindent.

There's a lot of LaTeX modes. I'm not sure how to distinguish them.

* Alphabetize apheleia-formatters and apheleia-mode-alist.

Alphabetizing them makes it easier to find which formatters are
supported.

* Add Java formatter with google-java-format.

* Add C and C++ formatter with clang-format.

* Update changelog

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-08-08 06:07:08 -07:00
Matthew Avant
52e0a140a8
Update apheleia-formatters type spec to avoid customize-variable error (#40)
* Update apheleia-formatters type spec to avoid customize-variable error

Declare all of the permitted special symbols used in apheleia-formatters commands.
Without this, 'customize-variable never allows settting the value of apheleia-formatters, instead reporting an error about a mismatch between the default value and the type.

* Update CHANGELOG.md

* Break long line

* Update CHANGELOG.md

* Update CHANGELOG.md

* Create CHANGELOG.md

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-07-22 19:16:42 -07:00
Radon Rosborough
f865c165da Avoid triggering after-set-visited-file-name-hook
This was causing LSP to reconnect every time I saved.
2021-05-23 15:00:07 -07:00
Radon Rosborough
876078f473 Remove unneeded check 2021-04-04 11:10:01 -07:00
Radon Rosborough
c364677f8e Use more stable tags 2021-04-04 10:59:18 -07:00
Radon Rosborough
230faa8942 Update 26.2 => 26.3 2021-04-04 10:52:48 -07:00
Radon Rosborough
30f5c13b8a Only build latest major versions
https://github.com/Silex/docker-emacs/issues/62
2021-04-04 10:48:26 -07:00
Radon Rosborough
64cb9e7d70 [#39] Don't mess up temporary buffers 2021-03-28 15:26:16 -07:00
Radon Rosborough
87115f5cda Revert "[#30] Run formatters in project root"
This reverts commit 66777303dc.

See https://github.com/raxod502/apheleia/issues/36,
https://github.com/raxod502/apheleia/pull/37 for discussion.
2021-03-14 13:31:23 -07:00
Radon Rosborough
b4975ca1bb Merge tag 'v1.1.2' 2021-02-26 22:04:53 -08:00
Radon Rosborough
53ac964e53 Release version 1.1.2 2021-02-26 22:04:05 -08:00
Radon Rosborough
02368ee1c7 [raxod502/selectrum#437] Use default outline-regexp 2021-02-25 20:16:50 -08:00
Radon Rosborough
f487ef185c Fix build for emacs-master 2021-02-20 09:37:36 -08:00
Radon Rosborough
f40300b9b5 [#32] Update changelog 2021-02-20 09:37:29 -08:00
Leo Gaskin
1e95db3f81
Fix spelling error in buffer name (#32) 2021-02-20 09:36:28 -08:00
Radon Rosborough
66777303dc [#30] Run formatters in project root 2021-02-18 20:06:50 -08:00
Albert Peschar
1ee7f3bc79
Fix infinite loop with rebinding after-save-hook (fixes #27) (#28)
* Fix infinite loop with rebinding after-save-hook (fixes #27)

* Satisfy linter

* Add docstring for new var

* Update changelog

* apheleia-format-buffer is asynchronous

* Update apheleia.el

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2021-02-07 08:50:31 -08:00
Radon Rosborough
8a1e68441c Enable Prettier in json-mode 2020-11-07 07:04:41 -08:00
Radon Rosborough
23ee6b5b4d [#21] Bugfix for 'filepath option 2020-11-07 04:38:39 -08:00
Radon Rosborough
3be4b486dc [#21] Make Prettier respect .prettierignore 2020-10-17 08:29:21 -07:00