Fuco1 / smartparens

Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
GNU General Public License v3.0
1.82k stars 194 forks source link

Double curly brace in web-mode triggers creation of third unpaired brace #610

Open adelq opened 8 years ago

adelq commented 8 years ago

I'm not sure what causes this bug, I don't know elisp but I'd be willing to help. I'm editing web templates in HTML files (specifically django templates), and I'm using web-mode. Essentially, smartparens expands the inside of a curly brace, but doesn't do so correct with double braces.

Bug:

Expected:
{|} -> {{|}} -> {{ | }}
Actual:
{|} -> {{|}} -> {{ | }}}

Works as expected:

{|} -> { | }
{|} -> {%|} -> {% | %}
Fuco1 commented 8 years ago

Probably web-mode tries to do the expantion as well and you get one too many. Do you use some special smartparens config, or a package like spacemacs, prelude? Sometimes configurations clash, it's quite common when multiple "smart/electric/auto..." packages get enabled at the same time.

adelq commented 8 years ago

I'm using spacemacs with nearly default settings. I don't think I have any other matching modes enabled, as when I disable smartparens in web-mode, I don't get any pairing of parens/braces, and entering a space in between braces has no effect (besides inserting the space).

After disabling smartparens-mode:

| -> {| -> {}| -> {|} -> { |}
{{|}} -> {{ |}}
{|} -> {%|} -> {% |}
adelq commented 8 years ago

Though, it's definitely something else in the spacemacs default configuration, since installing web-mode and smartparens on a vanilla emacs install does not have the behavior described (no expansion of parens, correct or incorrect).

Fuco1 commented 8 years ago

It might be a good idea then to open an issue on spacemacs as well and link here. They are quite responsive, and if needed we can implement something on our side to make it work. But it's hard to tell what it is now.

bobrowadam commented 4 years ago

Not sure if related but I had a similar issue when: {{|}} => {{ }}}} I've set (setq web-mode-enable-auto-pairing nil) to disable web-mode paring and rely only on smartparens. To make smartparens do what I want in web-mode I also added (require 'smartparens-config) to my settings to get a specific config for relevant modes (in this case web-mode). Please note I'm not using spacemacs