0

I'm using web-mode to edit my erb files. When I type <% emacs (or web-mode) adds a closing %> bracket. But when I type a space after the percent sign (i.e. %), an additional %> bracket is added.

I'm using prelude so there's a clue in prelude-web.el but I'm not sure how to interpret it. The relevant looking code looks like this:

(sp-with-modes '(web-mode)                                                                                                           
  (sp-local-pair "%" "%"                                                                                                             
                 :unless '(sp-in-string-p)                                                                                           
                 :post-handlers '(((lambda (&rest _ignored)                                                                          
                                     (just-one-space)                                                                                
                                     (save-excursion (insert " ")))                                                                  
                                   "SPC" "=" "#")))                                                                                  
  (sp-local-pair "<% "  " %>" :insert "C-c %")                                                                                       
  (sp-local-pair "<%= " " %>" :insert "C-c =")                                                                                       
  (sp-local-pair "<%# " " %>" :insert "C-c #")                                                                                       
  (sp-local-tag "%" "<% "  " %>")                                                                                                    
  (sp-local-tag "=" "<%= " " %>")                                                                                                    
  (sp-local-tag "#" "<%# " " %>"))

How do I configure emacs to stop adding these additional characters?

0

Here's a solution. Hopefully it will get pulled into prelude main branch soon. You can edit the file cited above:

https://github.com/bbatsov/prelude/pull/805

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.