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

fd, newline, smart parens and python mode #5261

Closed
aldanor opened this issue Feb 26, 2016 · 8 comments
Closed

fd, newline, smart parens and python mode #5261

aldanor opened this issue Feb 26, 2016 · 8 comments
Labels

Comments

@aldanor
Copy link

aldanor commented Feb 26, 2016

Emacs: 24.5.1 (Windows).
Spacemacs: latest develop.

How to reproduce: in Python-mode type ( RET f d which will result in

(
    )

instead of

(
)

because f seems to shift the second parenthesis in an irreversible fashion (closing the parentheses manually works ok of course).

This is a minor issue, not sure if it can be considered a bug but still, reporting it for the record.

@StreakyCobra
Copy link
Contributor

Confirmed with my different escape sequence (gq).

I don't know if it can be avoided. This effect is due to this:

(
)

is the correct indentation that python-mode gives to this line if there is only the closing parenthesis. If there is something on the second line, like:

(
    x)

the indentation is then shifted by 4 spaces, which is also the indentation the python-mode gives. I suppose whenever people press fd the indentation is adapted after the first keypress, thus indenting the line, the second keypress escaping and removing the first letter but not correcting the indentation.

This should probably be reported upstream to evil-escape.

@TheBB
Copy link
Contributor

TheBB commented Feb 26, 2016

Yeah this really does kill kittens. Thanks for the tip @StreakyCobra. I've had this issue in Python for a while and I never connected it to evil-escape.

@TheBB
Copy link
Contributor

TheBB commented Feb 27, 2016

For now I will be using

  (add-hook 'evil-insert-state-exit-hook 'indent-according-to-mode)

@syl20bnr
Copy link
Owner

Maybe using undo instead of the removing the char may work in evil-escape. I'll test it.

@calebmeyer
Copy link

Just a note (from #5313) This happens in ruby-mode as well. Test text (pipe is cursor position):

  def test
  end|

@TheBB
Copy link
Contributor

TheBB commented Mar 2, 2016

I retract my workaround. It's maddening.

@calebmeyer
Copy link

This has been reported upstream: syl20bnr/evil-escape#69

We can probably close this and follow the progress there.

@github-actions
Copy link

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!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants