Skip to content
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

open file using emacs FILE_NAME will not trigger format-onsave #7844

Open
4 tasks done
st0nie opened this issue Apr 24, 2024 · 1 comment
Open
4 tasks done

open file using emacs FILE_NAME will not trigger format-onsave #7844

st0nie opened this issue Apr 24, 2024 · 1 comment
Labels
is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet

Comments

@st0nie
Copy link

st0nie commented Apr 24, 2024

I confirm that...

  • I have searched the issue tracker, documentation, FAQ, Discourse, and Google, in case this issue has already been reported/resolved.

  • I have read "How to Debug Issues", and will use it to provide as much information about this issue as possible.

  • The issue can be reproduced on the latest available commit of Doom.

  • The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. (Unstable versions end in .50, .60, or .9x)

Expected behavior

When you edit a file with emacs FILE_NAME command in terminal, format-onsave is enabled.

Current behavior

Cannot make format-onsave working without opening another file.
I found this in lisp/doom-start.el:
318:(doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook))
And modules/editor/format/config.el:
47: (add-hook 'doom-first-file-hook #'apheleia-global-mode))
These mean that apheleia-global-mode will not be triggered if u open a file using emacs FILE_NAME
IDK whether this is expected behavior🤔

Steps to reproduce

For example:
Launch a terminal emulator

emacs test.cpp

Then edit the file, then save it

The file is not formatted automatically

System Information

https://pastebin.com/RGmaWJrc

@st0nie st0nie added is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet labels Apr 24, 2024
@st0nie st0nie changed the title open file using emacs FILE_NAME will not trigger format-onsave open file using emacs FILE_NAME will not trigger format-onsave Apr 24, 2024
@st0nie
Copy link
Author

st0nie commented Apr 24, 2024

Adding apheleia-global-mode to doom-first-input-hook or doom-first-buffer-hook may improve the existing situation, and I prefer the former.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet
Projects
Status: No status
Development

No branches or pull requests

1 participant