Repository navigation
Conversation
PuercoPop
commented
Sep 6, 2023
Comment on lines
+1762
to
+1763
| \(use-package go-mode | ||
| :hook ((go-mode . gofmt-mode))) |
Contributor
Author
There was a problem hiding this comment.
I included the use-package instructions because it is now included with Emacs. Let me know if you prefer to remove it
PuercoPop
commented
Sep 6, 2023
|
|
||
| (interactive) | ||
| (when (eq major-mode 'go-mode) (gofmt))) | ||
| (define-minor-mode gofmt-mode |
Contributor
Author
There was a problem hiding this comment.
The minor mode approach is what the prettier mode does as well. It was where I got the idea.
Owner
|
Thanks, I'll take a look at this soon. |
Using a minor mode has the advantage that disabling the hook is easier. To enable it (add-hook 'go-mode-hook 'gofmt-mode)
|
Any chance you've had time to look at this? 🙂 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using a minor mode has the advantage that disabling the hook is easier.
To enable it (add-hook 'go-mode-hook 'gofmt-mode)