-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Wrong indentation when opening a new line above the cursor in go #6520
Comments
Yeah, it's caused by clean-aindent-mode. Disabling it seems to fix this. I'm not sure why, it seems to work fine in e.g. C. |
Just came across this issue after upgrading to Spacemacs 0.200 last night. Also using Go. Exact same reproduction and expected behavior. Disabling System Info 💻
(javascript
(auto-completion :variables auto-completion-enable-help-tooltip t auto-completion-return-key-behavior 'complete auto-completion-tab-key-behavior 'cycle)
better-defaults emacs-lisp git markdown org ruby ruby-on-rails go osx sql react c-c++ spell-checking syntax-checking version-control
(shell :variables shell-default-shell 'eshell shell-default-height 30 shell-default-position 'bottom)) |
I'm running into the same issue. I have very little experience with emacs and elisp and I'm wondering how I can disable |
Looks like some hook on In your ".spacemacs" file:
Further investigation is still needed though: what about that conflicting package? What side effects will this have on it? |
The issue appears to be conflicting configurations between clean-aindent-mode and a go-mode post-command hook. This is meant to be a temporary solution and should be removed as soon as the underlying issue is solved. Issue: syl20bnr/spacemacs#6520
@wilfreddenton add (clean-aindent-mode -1) to user-config to disable clean-aindent-mode: |
Won't @dyxu suggestion also affect other languages though? I also code a lot of C, Perl, Python, Ruby, Bash for example and I don't want to disrupt those settings. Is there a plan to fix this issue or dive into it more? For now I'm using @db47h suggestion as it seems to work from what I have tested. |
FWIIW I also have this issue The following snippet does it for me: (defun dotspacemacs/user-config ()
;; Workaround for https://github.com/syl20bnr/spacemacs/issues/6520
;; seems that aindent mode conflicts with go-mode
(defun disable-aindent()
(clean-aindent-mode -1))
(add-hook 'go-mode-hook 'disable-aindent)
;; (...)
) It disables The suggestion around removing and adding System Info 💻
(helm asciidoc
(auto-completion :variables auto-completion-enable-help-tooltip t :disabled-for markdown org)
docker emacs-lisp epub git
(go :variables godoc-at-point-function 'godoc-gogetdoc)
html javascript lua markdown neotree
(org :variables org-enable-github-support t)
pdf python ranger
(shell :variables shell-default-height 30 shell-default-position 'bottom)
spacemacs-org spell-checking sql syntax-checking systemd theming version-control yaml)
|
I have tried to fix the related issue from xabbu42. For this I have made sure that the fix from db47h is applied when a mode is activated and if However this does not fix the problem @en reported. Here I see a lot of strange behaviour i.e. when I reproduce the issue and leave insert mode at the Here I am at my wits end, |
I've had more success licking my elbow than I have turning this stupid mode off in golang mode. It's super frustrating.
this was working and now randomly it stopped and I'm back to terrible indenting whenever I write a simple if err != nil statement which in golang is every 3rd line or whenever you blink, whichever comes first. None of these solutions work for me - I've tried just about everything I can think of including loading the package in last and then trying to disable it. My favorite part about being frustrated by a spacemacs package is that when you delete it, spacemacs auto defaults to reinstalling it when you reload or the other bonus feature when you want a new package that isn't specifically listed in additional packages spacemacs courteously removes it for you. TLDR -
|
@xshyne88 lol sounds like you had a real bad hair day :). Let's see if I can help disabling the package this should be pretty easy, in your user-config just add Every other hack like adding hocks won't work due to the fact that this mode has been defined as global minor mode which literally means there is no event you can wait for to activate it in one and deactivate it in another mode. Having artificially added hocks for that mode will randomly activate it so please remove them from your config if they are there. Anyway the good news is that mode is so old it should be pretty obsolete nowadays so disabling it globally should not have any negative side effects given your package is using a modern indentation model. Btw: You can customise the default package clean up behaviour by setting Hope that helps. |
@smile13241324 As much as I dislike spacemacs and it keeps beating me up, I still can't switch or give it up like a bad domestic abuse relationship because I keep remembering all the good time and it's literally just the best editor.
Part of my post is a rant but also self deprecating humor which I always thought developers loved. However I did mention in my post above that (clean-aindent-mode -1) is clearly not working for me.
The point was also to mention I'm sad to do this, I want to use solid packages like these in other modes. I'm sure it serves a good purpose, but right now I'm a golang developer and that's what I'm trying to figure out how to optimize. My short term > My long term, that's probably why I can't stop eating these free doughnuts at the office in the morning.
Global minor mode was not inside my brain until just now, maybe I should have combed the docs a little better.
I did know about the dotspacemacs-install-packages 'used-but-keep-unused I had alluded to it above but only found it after hours of pain and torture. Let me know if there's anyway I can help or contribute. |
Yeah sometimes emacs can be very frustrating, its a very old application
and despite our efforts to modernize, it ages fast.
One symptom of this is the existence of old unmaintained packages like the
one we discuss here. Normally I would remove it entirely but there is
normally always someone relying on just this package in his config.
However normally disabling such a package should not be a big issue. If it
is, like your case shows, we should make it globally configurable in your
dotfile.
I will make a PR for this.
As to helping, well if you are familiar with lisp (elisp clojur hy) you can
send PRs. If you rather into go (cool language by the way I am more into
python but I like its design) you can report issues you are running into so
that we can fix them. And of course contribute to the go lsp server which
solves like a trillion of bit rot issues in one step thanks to the
fantastic work over at lsp-mode which normally just works like your used to
from any other UI based IDE.
…On Tue, 10 Mar 2020, 16:52 Chase Philips, ***@***.***> wrote:
@smile13241324 <https://github.com/smile13241324>
Thanks for your help, time and demonstrated patience.
As much as I dislike spacemacs and it keeps beating me up, I still can't
switch or give it up like a bad domestic abuse relationship because I keep
remembering all the good time and it's literally just the best editor.
@xshyne88 <https://github.com/xshyne88> lol sounds like you had a real
bad hair day :).
Part of my post is a rant but also self deprecating humor which I always
thought developers loved. However I did mention in my post above that
(clean-aindent-mode -1) is clearly not working for me.
Anyway the good news is that mode is so old it should be pretty obsolete
nowadays so disabling it globally should not have any negative side effects
given your package is using a modern indentation model.
The point was also to mention I'm sad to do this, I want to use solid
packages like these in other modes. I'm sure it serves a good purpose, but
right now I'm a golang developer and that's what I'm trying to figure out
how to optimize. My short term > My long term, that's probably why I can't
stop eating these free doughnuts at the office in the morning.
Every other hack like adding hocks won't work due to the fact that this
mode has been defined as global minor mode which literally means there is
no event you can wait for to activate it in one and deactivate it in
another mode. Having artificially added hocks for that mode will randomly
activate it so please remove them from your config if they are there
Global minor mode was not inside my brain until just now, maybe I should
have combed the docs a little better.
Btw: You can customise the default package clean up behaviour by setting
dotspacemacs-install-packages 'used-but-keep-unused, this will prevent
spacemacs from removing any package from your system which you have wildly
installed. About excluding packages you are right, the only way to exclude
a managed package is to put it in dotspacemacs-additional-packages.
I did know about the dotspacemacs-install-packages 'used-but-keep-unused I
had alluded to it above but only found it after hours of pain and torture.
Let me know if there's anyway I can help or contribute.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6520?email_source=notifications&email_token=AEKCTACP4XMH4YCMIZL7RCLRGZO2RA5CNFSM4CIZZJAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOL7S4Q#issuecomment-597162354>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEKCTAGL2OFCLIF64GZPKLTRGZO2RANCNFSM4CIZZJAA>
.
|
@xshyne88 I have added a new setting to the dotfile Please sync your dotfile and give it a try. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
Description
Wrong indentation when opening a new line above the cursor in go
Reproduction guide
Observed behaviour:
the cursor is under "v"
Expected behaviour:
It works by using vim.
I noticed a "auto trimmed 1 chars" at the bottom. This message can be found in clean-aindent-mode.
I'm not familiar with elisp yet, could somebody look into this?
System Info
Backtrace
The text was updated successfully, but these errors were encountered: