-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer not being replaced when formatting with lisp function? #203
Comments
Note: I plan to fix the inability to concatenate filepath in the work for #212. |
The |
Note: I don't think it's very straightforward to fix the filepath concatenation issue sadly, however you can use |
Thanks your idea worked. At least for my use-case :) (defun shou/fix-apheleia-project-dir (orig-fn &rest args)
(let ((default-directory (vc-root-dir)))
(apply orig-fn args)))
(advice-add 'apheleia-format-buffer :around #'shou/fix-apheleia-project-dir)
(push '(spotless . ((concat default-directory "gradlew")
"spotlessApply"
(concat "-PspotlessIdeHook=" (apheleia-formatters-local-buffer-file-name))
"-PspotlessIdeHookUseStdIn"
"-PspotlessIdeHookUseStdOut"
"--quiet"))
apheleia-formatters)
(setf (alist-get 'java-mode apheleia-mode-alist)
'(spotless)) |
Help alleviate confusion like #203. --------- Co-authored-by: Mohsin Kaleem <[email protected]>
Context
I've decided to write a lisp function for formatting with spotless because I think the list format wouldn't allow
"-PspotlessIdeHook="
andfilepath
to be concatenated together. But when I tried this method it would insert the formatted code right below the original code.Example
Before:
After:
But when I run the cli manually, it only produces the formatted code.
The text was updated successfully, but these errors were encountered: