aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhilipp Stephani2017-12-31 17:43:43 +0100
committerPhilipp Stephani2018-01-07 13:52:59 +0100
commit6735df4443fe0aa60862a95c38746edf2b053862 (patch)
tree759392dc48f2ce4c60ba7eaa1476c2334a51f331 /test
parentf07c325d1f49e4b722f76aa730ac5d084bd0e77a (diff)
downloademacs-6735df4443fe0aa60862a95c38746edf2b053862.tar.gz
emacs-6735df4443fe0aa60862a95c38746edf2b053862.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/electric-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 44bdbc7b8c8..60191bfbbaa 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -742,6 +742,24 @@ baz\"\""
742 :bindings '((electric-quote-replace-double . t)) 742 :bindings '((electric-quote-replace-double . t))
743 :test-in-comments nil :test-in-strings nil) 743 :test-in-comments nil :test-in-strings nil)
744 744
745(define-electric-pair-test electric-quote-replace-double-escaped-open
746 "foo \\" "-----\"" :expected-string "foo \\“"
747 :expected-point 7 :modes '(emacs-lisp-mode c-mode)
748 :fixture-fn #'electric-quote-local-mode
749 :bindings '((electric-quote-replace-double . t)
750 (electric-quote-comment . t)
751 (electric-quote-string . t))
752 :test-in-comments t :test-in-strings t :test-in-code nil)
753
754(define-electric-pair-test electric-quote-replace-double-escaped-close
755 "foo \\“foo\\" "----------\"" :expected-string "foo \\“foo\\”"
756 :expected-point 12 :modes '(emacs-lisp-mode c-mode)
757 :fixture-fn #'electric-quote-local-mode
758 :bindings '((electric-quote-replace-double . t)
759 (electric-quote-comment . t)
760 (electric-quote-string . t))
761 :test-in-comments t :test-in-strings t :test-in-code nil)
762
745;; Simulate ‘markdown-mode’: it sets both ‘comment-start’ and 763;; Simulate ‘markdown-mode’: it sets both ‘comment-start’ and
746;; ‘comment-use-syntax’, but derives from ‘text-mode’. 764;; ‘comment-use-syntax’, but derives from ‘text-mode’.
747(define-electric-pair-test electric-quote-markdown-in-text 765(define-electric-pair-test electric-quote-markdown-in-text