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.81k stars 193 forks source link

Smart parens thrown off by escaped double-quote inside quotations. Interferes (very) minorly with wrap-to-double-quotes binding. #693

Open dwcoates opened 7 years ago

dwcoates commented 7 years ago

smart-paren-bug

This is a snapshot of my screen. Ironically the offending culprit happened to be a slew of smartparen bindings in my config file. This is an org-mode snippet, in org-mode. You can't see the source block headers because they are the same color as my background. Here they are for completeness:

#+BEGIN_SRC emacs-lisp 
#+END_SRC

That is the entirety of the file, btw. This problem was not evident before I upgraded to emacs 25.1.1. It may have been making the same mistake, but not throwing a visible error, though.

dwcoates commented 7 years ago
(bind-keys
 :map smartparens-mode-map
 ("C-c \"" . wrap-with-double-quotes))

is what fails. It's the "\"" for wrap-with-double-quotes. Not sure why it would throw off the matching of closed parens, though.

Fuco1 commented 7 years ago

If it's org-mode there's nothing we can do. Org uses different syntax settings and even though the text is fontified as emacs lisp it is still an org-mode content---the emacs lisp rules do not apply.

This is a general problem with emacs where you can only have one mode active at a time.

What would be possible, but I'm not sure how difficult, would be to copy the entire block to an emacs lisp mode buffer, do the parsing there, and then carry the info over to the org-mode buffer, adjust the offsets and so on... that sounds so hackish I'm not really quite sure it would work :D but now I think I want to try it.

dwcoates commented 7 years ago

ah, okay. It's such a small issue, anyway. Let me know how your diabolical plans pan out