5

I am fairly new to customizing my emacs, so please be gentle. I did try to find a solution for this, but all I found was a page on git where someone asked a similar question but (as far as I can tell) never received an answer.

I have both smartparens and web-mode installed and am trying to work in .html.erb files.

The issue I am having is that whenever I type <%space I end up with <% %>> (notice the extra angular bracket).

Does anyone have any suggestions for how to deal with this, and how I would go about it? I don't really want to disable either of the packages.

Drew
  • 75,699
  • 9
  • 109
  • 225
Kittenmittons
  • 203
  • 1
  • 6
  • Would you mind posting your previous solution as well? Perhaps in the same post.. I'll give both a try – Kittenmittons Aug 31 '15 at 14:52
  • In that i was disabling `smartparens-mode`, so i have updated the answer. You can check that https://emacs.stackexchange.com/posts/15192/revisions – Chillar Anand Aug 31 '15 at 15:45

1 Answers1

7

You can turn off auto pairing for web mode and enable pairing for < & % in smartparens.

(require 'smartparens)
(sp-pair "%" "%" :wrap "C-%")
(sp-pair "<" ">" :wrap "C->")

(require 'web-mode)
(setq web-mode-enable-auto-pairing nil)

Now when you press <%space you will get <% %> with both modes enabled.

Chillar Anand
  • 4,042
  • 1
  • 23
  • 52