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

when smartparens mode enabled, type ' always insert \'\' #815

Open Yu-da-xia opened 6 years ago

Yu-da-xia commented 6 years ago

Expected behavior

type ' key will insert ''

Actual behavior

type ' key \'\'

Steps to reproduce the problem

always have this problem. don't know how to configure

Backtraces if necessary (M-x toggle-debug-on-error)

no error

Environment & version information

In recent enough smartparens you can call M-x sp-describe-system to generate this report. Please fill manually what we could not detect automatically. Edit the output as you see fit to protect your privacy.

Fuco1 commented 6 years ago

Can you please fill the Environment & version information section? Hard to debug with pretty much no information.

CSRaghunandan commented 6 years ago

I'm also facing the same problem. Smartparens version: 20171126.1241 I'm running emacs compiled for master branch on Mac OS Sierra. I'm not using any startkits. Just good old vanilla emacs with my own customization.

Fuco1 commented 6 years ago

@CSRaghunandan Does this happen everywhere or only in specific major modes? What is the emacs version?

CSRaghunandan commented 6 years ago

@Fuco1 This seems to happen only in c-based modes for me, checked rust, python, and js2-mode and all of them are fine.

emacs version: GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G1036)) of 2017-11-27

Fuco1 commented 6 years ago

So it seems the handling of string parsing changed in Emacs 27 (which I guess is the 26 preview?). I'm not sure I want to get into this if it is not released yet as they might change it back or to something else again and then it's a waste of effort :/

Would it be an option for you to use the latest stable release? I know it's not much of a solution but I'm not capable of supporting the nightly builds, there's too much changes going on and only one person to look over :/

CSRaghunandan commented 6 years ago

@Fuco1 Yeah, I can understand.

Instead of moving to latest stable release, I would rather make an exception for closing of ' in c and cpp modes since those are the only ones affected. I see that there is a sp-local-pair variable, but how do I use it?

Fuco1 commented 6 years ago

Right. You can do (sp-local-pair 'c-mode "'" nil :actions nil), that should do the trick.