summaryrefslogtreecommitdiff
path: root/test/lisp/electric-tests.el
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2017-07-02 18:14:21 +0200
committerPhilipp Stephani <phst@google.com>2017-07-09 21:55:31 +0200
commitbb2ea81bc569bdc51e1c9af1c503a22fb95e4384 (patch)
tree6daac769532574d017f24fe386d23f136072bd56 /test/lisp/electric-tests.el
parent633db417fc3e905b28b017facdf596b36914b44d (diff)
downloademacs-bb2ea81bc569bdc51e1c9af1c503a22fb95e4384.tar.gz
Further improve electric quote support for Markdown (Bug#24709)
Markdown sets both 'comment-start' and 'comment-use-syntax' to non-nil values. Therefore 'electric-quote-mode' recognized it as a programming mode. Fix this by first checking whether the current major mode is derived from 'text-mode'. * lisp/electric.el (electric-quote-post-self-insert-function): Treat 'text-mode' as stronger signal than comment syntax. * test/lisp/electric-tests.el (electric-quote-markdown-in-text) (electric-quote-markdown-in-code): Adapt unit tests.
Diffstat (limited to 'test/lisp/electric-tests.el')
-rw-r--r--test/lisp/electric-tests.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index c4ccec7a0d8..c6ffccc0794 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -694,6 +694,8 @@ baz\"\""
:bindings '((electric-quote-context-sensitive . t))
:test-in-comments nil :test-in-strings 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
"" "'" :expected-string "’" :expected-point 2
:modes '(text-mode)
@@ -703,6 +705,7 @@ baz\"\""
(lambda ()
(save-excursion (search-backward "`" nil t)))
nil :local))
+ :bindings '((comment-start . "<!--") (comment-use-syntax . t))
:test-in-comments nil :test-in-strings nil)
(define-electric-pair-test electric-quote-markdown-in-code
@@ -714,6 +717,7 @@ baz\"\""
(lambda ()
(save-excursion (search-backward "`" nil t)))
nil :local))
+ :bindings '((comment-start . "<!--") (comment-use-syntax . t))
:test-in-comments nil :test-in-strings nil)
(provide 'electric-tests)