Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double quote behavior inconsistent #374

Closed
jgarvin opened this issue Oct 23, 2014 · 12 comments
Closed

Double quote behavior inconsistent #374

jgarvin opened this issue Oct 23, 2014 · 12 comments

Comments

@jgarvin
Copy link

jgarvin commented Oct 23, 2014

Emacs 24.4, running with -Q, loading just dash and smartparens-config. You can get 3 different behaviors when you write a double quote:

  1. Write a double quote, then do so a second time without inserting any other characters into the buffer. The first time you press double quote, you get "|". The second time you get "\"|\"". Almost certainly not what you want.
  2. Write a double quote. then write a word without spaces, then another double quote. The first time you get "|", then you add your word, "hello|", then you press the second quote, and it closes the string, "hello"|. This is the behavior I would always expect and the one consistent with how parenthesis behave.
  3. Write a double quote, then write two words with a space between them, then another quote. "|" -> "hello world|" -> "hello world\"|\"", similar to the first behavior. Almost certainly not what you want.
@Fuco1
Copy link
Owner

Fuco1 commented Oct 23, 2014

Agreed, I should probably make the defaults better. For me, all three cases behave as 2, which is probably what you would always want.

Or this is a 24.4 introduced regression. I haven't updated yet. If you have 24.3 or some older version, could you please check if the behaviour is the same?

@jgarvin
Copy link
Author

jgarvin commented Oct 24, 2014

The other emacs I have installed is 23.4.1. This version acts differently but still not right. Scenario 1 is the same. Scenario 2 and 3 are swapped -- now it requires a space to work, and if you don't provide one will try to nest the quotes.

I should add in this version I have to include my own copy of cl-lib 0.3, and it complains about lexical binding when it works correctly in Scenario 3 but gives no error in Scenarios 1 or 2. Those errors are what made me decide to bother installing 24.4 ;p

Edit: should add all my testing is in the emacs scratch buffer, though I've seen the same behavior in python buffers.

@dpathakj
Copy link

On GNU Emacs 24.3.1 with just smartparens.el and dash.el I've seen (1) and (2) but not (3). (1) seems like a bug--if you don't see it, do you know what configuration of yours is fixing it?

@sooheon
Copy link

sooheon commented Oct 29, 2014

The three cases behave as 2 for me on 24.4, but there is a fourth:

Write a double quote, write any number of characters, delete any number of characters, write a double quote again. For example, a double quote, followed by helloo, followed by a single delete and a closing quote results in the following: "hello\"|\""

In other words, the normal use case of seamlessly closing a double quote by typing another " is disrupted should you make any edits that require delete.

@jgarvin
Copy link
Author

jgarvin commented Nov 17, 2014

@sooheon are you using -Q?

@sooheon
Copy link

sooheon commented Dec 8, 2014

@jgarvin It turns out the behaviour I was seeing after backspacing within a pair was determined by sp-cancel-autoskip-on-backward-movement. Setting this to nil solved my issue.

@mpontus
Copy link
Contributor

mpontus commented Jan 19, 2015

With or without escaping, auto-skip currently doesn't apply to empty strings in single and doublequotes.

@sooheon
Copy link

sooheon commented Jan 19, 2015

I see the same behaviour as @MyEffort with 24.4.1 and the latest melpa smartparens.

@Fuco1 Fuco1 modified the milestone: 1.8 Feb 17, 2015
@Fuco1
Copy link
Owner

Fuco1 commented Jun 18, 2016

The issue with double quotes is now fixed in fa4fb22. Single quotes still behave somewhat odd (at least in python and php modes). I'm on it right now.

@Fuco1
Copy link
Owner

Fuco1 commented Jun 18, 2016

Could any of you please verify that the problems are gone?

@sooheon
Copy link

sooheon commented Jun 18, 2016

These specific problems are gone, but a new bug is here. Values of sp-cancel-autoskip-on-backward-movement t and sp-autoskip-closing-pair 'always are not respected.

With those two variables set, try the following:

  1. type "hello world"
  2. M-b back to middle space, and delete it, leaving "hello|world"
  3. Press "

This will split the string, while the above settings means you should get sp-up-sexp, i.e. autoskip closing pair.

@Fuco1
Copy link
Owner

Fuco1 commented Jun 19, 2016

Hm, I don't think it ever worked with quotes. Which is not to say it shouldn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants