summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2013-04-07 16:32:19 +0000
committerTaylor R Campbell <campbell@mumble.net>2013-04-07 16:32:19 +0000
commit460254d20624057f8ededfeb822891492c908c66 (patch)
tree6828a87cedced9a0731d0f0d59a6a5cb4f65bd80
parentdc96f75f58be03703ae905d5dde055e3436d048a (diff)
Fix paredit-doublequote inside a string escape.
-rw-r--r--paredit.el9
-rw-r--r--test.el3
2 files changed, 8 insertions, 4 deletions
diff --git a/paredit.el b/paredit.el
index 3ad7f72..fcf50b7 100644
--- a/paredit.el
+++ b/paredit.el
@@ -875,10 +875,11 @@ If in a character literal, do nothing. This prevents accidentally
delimiter unintentionally."
(interactive "P")
(cond ((paredit-in-string-p)
- (if (eq (cdr (paredit-string-start+end-points))
- (point))
- (forward-char) ; We're on the closing quote.
- (insert ?\\ ?\" )))
+ (if (eq (point) (- (paredit-enclosing-string-end) 1))
+ (forward-char) ; Just move past the closing quote.
+ ;; Don't split a \x into an escaped backslash and a string end.
+ (if (paredit-in-string-escape-p) (forward-char))
+ (insert ?\\ ?\" )))
((paredit-in-comment-p)
(insert ?\" ))
((not (paredit-in-char-p))
diff --git a/test.el b/test.el
index 7d12283..ba71788 100644
--- a/test.el
+++ b/test.el
@@ -234,6 +234,9 @@ Four arguments: the paredit command, the text of the buffer
;; `comment-search-forward' to wind up inside a character or a
;; string?
))
+
+(paredit-test 'paredit-doublequote
+ '(("\"foo \\|x bar\"" "\"foo \\x\\\"| bar\"")))
(paredit-test 'paredit-forward-delete
'(("f|oo" "f|o")