smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

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

Open Yu-da-xia opened this issue 8 years ago • 7 comments

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.

  • smartparens version:
  • Active major-mode:
  • Emacs version (M-x emacs-version):
  • Spacemacs/Evil/Other starterkit (specify which)/Vanilla:
  • OS:

Yu-da-xia avatar Nov 24 '17 09:11 Yu-da-xia

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

Fuco1 avatar Nov 24 '17 10:11 Fuco1

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.

CSRaghunandan avatar Nov 28 '17 10:11 CSRaghunandan

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

Fuco1 avatar Nov 28 '17 10:11 Fuco1

@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

CSRaghunandan avatar Nov 28 '17 15:11 CSRaghunandan

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 :/

Fuco1 avatar Nov 28 '17 15:11 Fuco1

@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?

CSRaghunandan avatar Nov 28 '17 16:11 CSRaghunandan

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

Fuco1 avatar Nov 28 '17 20:11 Fuco1