aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--apheleia.el40
2 files changed, 9 insertions, 36 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d925cf..eee8d5e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,11 +4,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog].
## Unreleased
-### Enhancements
-* Formatters are now run by default in the root directory of your
- project (as defined by `project.el` or Projectile, defaulting to the
- working directory). See [#30].
-
### Bugs fixed
* Fix spelling error in generated process names ([#32]).
diff --git a/apheleia.el b/apheleia.el
index 90a1eaa..f85e833 100644
--- a/apheleia.el
+++ b/apheleia.el
@@ -25,35 +25,14 @@
(require 'cl-lib)
(require 'map)
-(require 'project)
(require 'subr-x)
-(declare-function projectile-project-root "ext:projectile")
-
(defgroup apheleia nil
"Reformat buffer without moving point."
:group 'external
:link '(url-link :tag "GitHub" "https://github.com/raxod502/apheleia")
:link '(emacs-commentary-link :tag "Commentary" "apheleia"))
-(defun apheleia--project-root ()
- "Return the directory containing the current project.
-This is an absolute path ending in a slash. It uses `project' and
-then `projectile' (if the latter is installed), before falling
-back to `default-directory'."
- (expand-file-name
- (if-let ((project (project-current)))
- ;; `project-roots' was replaced with `project-root' in Emacs
- ;; 28, and the former function deprecated. Use whichever one is
- ;; available and non-deprecated.
- (with-no-warnings
- (if (fboundp 'project-root)
- (project-root project)
- (car (project-roots project))))
- (or (and (require 'projectile nil 'noerror)
- (projectile-project-root))
- default-directory))))
-
(cl-defun apheleia--edit-distance-table (s1 s2)
"Align strings S1 and S2 for minimum edit distance.
Return the dynamic programming table as has table which maps cons
@@ -458,16 +437,15 @@ modified from what is written to disk, then don't do anything."
output-fname
arg))
command)))
- (let ((default-directory (apheleia--project-root)))
- (apheleia--make-process
- :command command
- :stdin (unless input-fname
- (current-buffer))
- :callback (lambda (stdout)
- (when output-fname
- (erase-buffer)
- (insert-file-contents-literally output-fname))
- (funcall callback stdout)))))))
+ (apheleia--make-process
+ :command command
+ :stdin (unless input-fname
+ (current-buffer))
+ :callback (lambda (stdout)
+ (when output-fname
+ (erase-buffer)
+ (insert-file-contents-literally output-fname))
+ (funcall callback stdout))))))
(defcustom apheleia-formatters
'((black . ("black" "-"))