diff options
| author | Philipp Stephani | 2017-07-23 21:58:49 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-10-01 00:20:36 +0200 |
| commit | d247e1d30abcb77665f829ca98a5bdef69ff4bc3 (patch) | |
| tree | db9c7b1127eaa1860fbc586c8eace53ea4e3c4f2 /test | |
| parent | d88a0f6554888643854ddb2c1f49b77b0bf8904c (diff) | |
| download | emacs-d247e1d30abcb77665f829ca98a5bdef69ff4bc3.tar.gz emacs-d247e1d30abcb77665f829ca98a5bdef69ff4bc3.zip | |
Electric quote mode: Conditionally replace " (Bug#24710)
* lisp/electric.el (electric-quote-replace-double): New user option.
(electric-quote-post-self-insert-function): Use it.
* test/lisp/electric-tests.el (electric-quote-replace-double-disabled)
(electric-quote-replace-double-bob)
(electric-quote-replace-double-bol)
(electric-quote-replace-double-after-space)
(electric-quote-replace-double-after-letter)
(electric-quote-replace-double-after-paren): New unit tests.
* doc/emacs/text.texi (Quotation Marks): Document
'electric-quote-replace-double'.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/electric-tests.el | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index fc69919fbe1..7df2449b9eb 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el | |||
| @@ -617,6 +617,12 @@ baz\"\"" | |||
| 617 | :fixture-fn #'electric-quote-local-mode | 617 | :fixture-fn #'electric-quote-local-mode |
| 618 | :test-in-comments nil :test-in-strings nil) | 618 | :test-in-comments nil :test-in-strings nil) |
| 619 | 619 | ||
| 620 | (define-electric-pair-test electric-quote-replace-double-disabled | ||
| 621 | "" "\"" :expected-string "\"" :expected-point 2 | ||
| 622 | :modes '(text-mode) | ||
| 623 | :fixture-fn #'electric-quote-local-mode | ||
| 624 | :test-in-comments nil :test-in-strings nil) | ||
| 625 | |||
| 620 | (define-electric-pair-test electric-quote-context-sensitive-backtick | 626 | (define-electric-pair-test electric-quote-context-sensitive-backtick |
| 621 | "" "`" :expected-string "`" :expected-point 2 | 627 | "" "`" :expected-string "`" :expected-point 2 |
| 622 | :modes '(text-mode) | 628 | :modes '(text-mode) |
| @@ -638,6 +644,13 @@ baz\"\"" | |||
| 638 | :bindings '((electric-quote-context-sensitive . t)) | 644 | :bindings '((electric-quote-context-sensitive . t)) |
| 639 | :test-in-comments nil :test-in-strings nil) | 645 | :test-in-comments nil :test-in-strings nil) |
| 640 | 646 | ||
| 647 | (define-electric-pair-test electric-quote-replace-double-bob | ||
| 648 | "" "\"" :expected-string "“" :expected-point 2 | ||
| 649 | :modes '(text-mode) | ||
| 650 | :fixture-fn #'electric-quote-local-mode | ||
| 651 | :bindings '((electric-quote-replace-double . t)) | ||
| 652 | :test-in-comments nil :test-in-strings nil) | ||
| 653 | |||
| 641 | (define-electric-pair-test electric-quote-context-sensitive-bol-single | 654 | (define-electric-pair-test electric-quote-context-sensitive-bol-single |
| 642 | "a\n" "--'" :expected-string "a\n‘" :expected-point 4 | 655 | "a\n" "--'" :expected-string "a\n‘" :expected-point 4 |
| 643 | :modes '(text-mode) | 656 | :modes '(text-mode) |
| @@ -652,6 +665,13 @@ baz\"\"" | |||
| 652 | :bindings '((electric-quote-context-sensitive . t)) | 665 | :bindings '((electric-quote-context-sensitive . t)) |
| 653 | :test-in-comments nil :test-in-strings nil) | 666 | :test-in-comments nil :test-in-strings nil) |
| 654 | 667 | ||
| 668 | (define-electric-pair-test electric-quote-replace-double-bol | ||
| 669 | "a\n" "--\"" :expected-string "a\n“" :expected-point 4 | ||
| 670 | :modes '(text-mode) | ||
| 671 | :fixture-fn #'electric-quote-local-mode | ||
| 672 | :bindings '((electric-quote-replace-double . t)) | ||
| 673 | :test-in-comments nil :test-in-strings nil) | ||
| 674 | |||
| 655 | (define-electric-pair-test electric-quote-context-sensitive-after-space-single | 675 | (define-electric-pair-test electric-quote-context-sensitive-after-space-single |
| 656 | " " "-'" :expected-string " ‘" :expected-point 3 | 676 | " " "-'" :expected-string " ‘" :expected-point 3 |
| 657 | :modes '(text-mode) | 677 | :modes '(text-mode) |
| @@ -666,6 +686,13 @@ baz\"\"" | |||
| 666 | :bindings '((electric-quote-context-sensitive . t)) | 686 | :bindings '((electric-quote-context-sensitive . t)) |
| 667 | :test-in-comments nil :test-in-strings nil) | 687 | :test-in-comments nil :test-in-strings nil) |
| 668 | 688 | ||
| 689 | (define-electric-pair-test electric-quote-replace-double-after-space | ||
| 690 | " " "-\"" :expected-string " “" :expected-point 3 | ||
| 691 | :modes '(text-mode) | ||
| 692 | :fixture-fn #'electric-quote-local-mode | ||
| 693 | :bindings '((electric-quote-replace-double . t)) | ||
| 694 | :test-in-comments nil :test-in-strings nil) | ||
| 695 | |||
| 669 | (define-electric-pair-test electric-quote-context-sensitive-after-letter-single | 696 | (define-electric-pair-test electric-quote-context-sensitive-after-letter-single |
| 670 | "a" "-'" :expected-string "a’" :expected-point 3 | 697 | "a" "-'" :expected-string "a’" :expected-point 3 |
| 671 | :modes '(text-mode) | 698 | :modes '(text-mode) |
| @@ -680,6 +707,13 @@ baz\"\"" | |||
| 680 | :bindings '((electric-quote-context-sensitive . t)) | 707 | :bindings '((electric-quote-context-sensitive . t)) |
| 681 | :test-in-comments nil :test-in-strings nil) | 708 | :test-in-comments nil :test-in-strings nil) |
| 682 | 709 | ||
| 710 | (define-electric-pair-test electric-quote-replace-double-after-letter | ||
| 711 | "a" "-\"" :expected-string "a”" :expected-point 3 | ||
| 712 | :modes '(text-mode) | ||
| 713 | :fixture-fn #'electric-quote-local-mode | ||
| 714 | :bindings '((electric-quote-replace-double . t)) | ||
| 715 | :test-in-comments nil :test-in-strings nil) | ||
| 716 | |||
| 683 | (define-electric-pair-test electric-quote-context-sensitive-after-paren-single | 717 | (define-electric-pair-test electric-quote-context-sensitive-after-paren-single |
| 684 | "(" "-'" :expected-string "(‘" :expected-point 3 | 718 | "(" "-'" :expected-string "(‘" :expected-point 3 |
| 685 | :modes '(text-mode) | 719 | :modes '(text-mode) |
| @@ -694,6 +728,13 @@ baz\"\"" | |||
| 694 | :bindings '((electric-quote-context-sensitive . t)) | 728 | :bindings '((electric-quote-context-sensitive . t)) |
| 695 | :test-in-comments nil :test-in-strings nil) | 729 | :test-in-comments nil :test-in-strings nil) |
| 696 | 730 | ||
| 731 | (define-electric-pair-test electric-quote-replace-double-after-paren | ||
| 732 | "(" "-\"" :expected-string "(“" :expected-point 3 | ||
| 733 | :modes '(text-mode) | ||
| 734 | :fixture-fn #'electric-quote-local-mode | ||
| 735 | :bindings '((electric-quote-replace-double . t)) | ||
| 736 | :test-in-comments nil :test-in-strings nil) | ||
| 737 | |||
| 697 | ;; Simulate ‘markdown-mode’: it sets both ‘comment-start’ and | 738 | ;; Simulate ‘markdown-mode’: it sets both ‘comment-start’ and |
| 698 | ;; ‘comment-use-syntax’, but derives from ‘text-mode’. | 739 | ;; ‘comment-use-syntax’, but derives from ‘text-mode’. |
| 699 | (define-electric-pair-test electric-quote-markdown-in-text | 740 | (define-electric-pair-test electric-quote-markdown-in-text |