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

Double quote behaviour is wrong in slime-repl #451

Closed tmccombs closed 9 years ago

tmccombs commented 9 years ago

In the slime-repl, double quotes do not work at all.

The first time you enter a double quote it inserts a single quote, but the second time, it insertst two:

1: (format nil |) 2 : (format nil "|) After pressing " 3: (format nil "foo|) 4: (format nil "foo"|") after pressing " again

This only seems to happen inside of an s-expre (a string as the top level expression works fine). It is extremely inconvenient because it leaves me with an odd number of quotes, and I have to either use C-q " to insert a single quote or C-0 <DEL> to delete one of the quotes.

tmccombs commented 9 years ago

Ok, I think that the problem is caused when there is an add number of double quotes in the output from an expression. That is the problem is that smartparens is searching the whole buffer for a matching " instead of just the current expression. I'm not sure what a good solution for this would be.

Fuco1 commented 9 years ago

This is a recurring problem with REPLs. A good solution would be to have a hook or some wrapper around the parsing code that would narrow to specific region (in our case, the REPL/comint input line) and does the matching there.

One could then add some code to the repl mode hook to set up appropriate narrowing. In case of comint based modes, there could be a predefined function for this.

I might look at this over the weekend, or if you think you can fix it, I'm happy to take a patch :p

The top-level entry point to the expression parser is sp-get-thing