apheleia/apheleia.el

37 lines
1.1 KiB
EmacsLisp
Raw Normal View History

2019-07-07 14:13:57 -07:00
;;; apheleia.el --- Reformat buffer stably -*- lexical-binding: t -*-
2022-05-09 15:58:41 -07:00
;; Copyright (C) 2019-2022 Radian LLC and contributors
2019-07-07 14:13:57 -07:00
2022-05-09 15:58:41 -07:00
;; Author: Radian LLC <contact+apheleia@radian.codes>
2019-07-07 14:13:57 -07:00
;; Created: 7 Jul 2019
;; Homepage: https://github.com/raxod502/apheleia
;; Keywords: tools
Support formatting remote files with Tramp (#76) * [#33] Support remote buffers and files CLOSES #33 Adds support for formatting remote files. The new `apheleia-remote-algorithm` option configures this. The default behaviour is consistent with what we had before, with `apheleia` aborting a formatting when dealing with a remote file/buffer. Users can customise apheleia to run the formatter on the remote machine, in which case any temporary files or other checks such as `npx` will be fully handled on the remote machine. Users can also make apheleia run the formatter on the local machine. This works exactly like one would expect, except if the formatter requires access to the physical file (meaning it uses 'file in `apheleia-formatters`) because the file isn't available on the local machine. This PR also fixes a bug in apheleia where `input-fname` was assigned in local let scope, instead of being returned by `apheleia--format-command`, meaning any formatters using a 'input file weren't cleaned up after formatting. * Cleanup + run diffs on remote as well * Fix diff uses correct file path for remote files If a file being diffed is remote, but the program is being run locally, then we create a temporary file on the current machine. * Make a few style changes * Drop support for Emacs 25 * Fix GitHub Actions triggers * Don't run tests on Emacs 25 either * Make apheleia run synchronously when running on remote Also added a metadata field to function based formatters. * feat: Suppress meaningless messages while formatting synchronously Also fixed any linter complaints. * bug: Make running formatter locally on remote buffer synchronous More re-entrant tramp issues. * Update apheleia.el * review: Replace custom temp-file logic with make-nearby-temp-file * review: Revamp functional formatter interface * refactor: Rework remote file handling implementation + Reordered parameters to ensure remote always comes before callback. + Updated some docstrings. * bug: Re-add apheleia--make-temp-file We don't always want to create a temporary file on the remote, only when apheleia-remote-algorithm is 'remote. * bug: Prevent repeat diff-file invocation with 2 files Previously we always made a temp-file for diffing the formatted and unformatted buffer leading to a bug when trying to send stdin to the formatter process. Now we only perform this check when running both locally and remotely. * Update changelog Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
2022-04-10 22:21:50 +01:00
;; Package-Requires: ((emacs "26"))
2020-04-04 09:50:44 -06:00
;; SPDX-License-Identifier: MIT
2023-02-25 11:31:26 -08:00
;; Version: 3.2
2019-07-07 14:13:57 -07:00
;;; Commentary:
;; Apheleia is an Emacs Lisp package which allows you to reformat a
;; buffer without moving point. This solves the usual problem of
;; running a tool like Prettier or Black on `before-save-hook', namely
;; that it resets point to the beginning of the buffer. Apheleia
;; maintains the position of point relative to its surrounding text
;; even if the buffer is modified by the reformatting.
;; Please see https://github.com/raxod502/apheleia for more information.
;;; Code:
(require 'apheleia-core)
2019-07-07 14:13:57 -07:00
(defgroup apheleia nil
"Reformat buffer without moving point."
2019-07-07 14:13:57 -07:00
:group 'external
:link '(url-link :tag "GitHub" "https://github.com/raxod502/apheleia")
:link '(emacs-commentary-link :tag "Commentary" "apheleia"))
(provide 'apheleia)
;;; apheleia.el ends here