[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 6735df4: Ignore escape characters for context-sensi
From: |
Philipp Stephani |
Subject: |
[Emacs-diffs] master 6735df4: Ignore escape characters for context-sensitive quotes (Bug#29812) |
Date: |
Sun, 7 Jan 2018 07:53:31 -0500 (EST) |
branch: master
commit 6735df4443fe0aa60862a95c38746edf2b053862
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>
Ignore escape characters for context-sensitive quotes (Bug#29812)
* lisp/electric.el (electric-quote-post-self-insert-function): Skip
over escape characters when determining whether a context-sensitive
quote should be opening or closing.
* test/lisp/electric-tests.el
(electric-quote-replace-double-escaped-open)
(electric-quote-replace-double-escaped-close): New unit tests.
---
lisp/electric.el | 1 +
test/lisp/electric-tests.el | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/lisp/electric.el b/lisp/electric.el
index 8343d8c..c00e7c0 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -505,6 +505,7 @@ This requotes when a quoting key is typed."
(eq last-command-event ?\")))
(save-excursion
(backward-char)
+ (skip-syntax-backward "\\")
(or (bobp) (bolp)
(memq (char-before) (list q< q<<))
(memq (char-syntax (char-before))
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 44bdbc7..60191bf 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -742,6 +742,24 @@ baz\"\""
:bindings '((electric-quote-replace-double . t))
:test-in-comments nil :test-in-strings nil)
+(define-electric-pair-test electric-quote-replace-double-escaped-open
+ "foo \\" "-----\"" :expected-string "foo \\“"
+ :expected-point 7 :modes '(emacs-lisp-mode c-mode)
+ :fixture-fn #'electric-quote-local-mode
+ :bindings '((electric-quote-replace-double . t)
+ (electric-quote-comment . t)
+ (electric-quote-string . t))
+ :test-in-comments t :test-in-strings t :test-in-code nil)
+
+(define-electric-pair-test electric-quote-replace-double-escaped-close
+ "foo \\“foo\\" "----------\"" :expected-string "foo \\“foo\\”"
+ :expected-point 12 :modes '(emacs-lisp-mode c-mode)
+ :fixture-fn #'electric-quote-local-mode
+ :bindings '((electric-quote-replace-double . t)
+ (electric-quote-comment . t)
+ (electric-quote-string . t))
+ :test-in-comments t :test-in-strings t :test-in-code nil)
+
;; Simulate ‘markdown-mode’: it sets both ‘comment-start’ and
;; ‘comment-use-syntax’, but derives from ‘text-mode’.
(define-electric-pair-test electric-quote-markdown-in-text
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 6735df4: Ignore escape characters for context-sensitive quotes (Bug#29812),
Philipp Stephani <=