rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.1k stars 176 forks source link

Disabling automatic brace insertion #512

Closed 949f45ac closed 4 months ago

949f45ac commented 4 months ago

Hey there, landed here from https://github.com/brotzeit/rustic/issues/541

To recap, I am looking for a way to disable the emacs behavior where it inserts closing braces automatically in my Rust code, when I try to add braces to an existing piece of code somewhere.

The added braces (both normal and curly) are reliably in the wrong spot, and I cannot even outsmart the feature by inserting the non-matched closing brace first – it will still insist on adding another closing brace, reliably in a stupid spot.

I get generally unnerved when my editor inserts characters without me typing them. In this case the auto-edit’s quality is especially horrendous.

I am not sure rust-mode is to blame, I searched through the code briefly and did not find a lead. Please point me to the culprit. I have made sure that electric-pair-mode is not to blame, by explicitly toggling it off (it was already off).

psibi commented 4 months ago

I'm not able to reproduce the behavior, but I'm using the treesitter based mode implemented in this PR: https://github.com/rust-lang/rust-mode/pull/482

psibi commented 4 months ago

Please keep it this way, and never add any automatic characters to that mode.

Yeah, that's the plan. Maybe some helper functions to navigate, but I want to leave most of the things to tree sitter.

Don’t know if this is the intended experience, reading just through this repo’s README it didn’t seem like any special installation steps would be required.

I have heard from others that the installation experience is not that good yet. Feel free to send a documentation patch to update the README with instructions for your OS.

Thanks for the confirmation, I'm closing the issue since it's fixed.