diff options
| author | Philipp Stephani | 2017-07-03 18:46:10 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-07-03 20:59:31 +0200 |
| commit | 4cd0db3d6e6e4d5bd49283483bdafbbfc0f583f1 (patch) | |
| tree | 4363283d8e790be49490ce2123f32db811e083f9 /test | |
| parent | 9ac7dccc51ee834b06cdabf6a5746eb375f984f0 (diff) | |
| download | emacs-4cd0db3d6e6e4d5bd49283483bdafbbfc0f583f1.tar.gz emacs-4cd0db3d6e6e4d5bd49283483bdafbbfc0f583f1.zip | |
Use hook instead of face list to inhibit electric quoting
This is more flexible and doesn't couple electric quoting to font
locking.
Give that 'electric-quote-code-faces' was just introduced, remove it
without formal deprecation.
* lisp/electric.el (electric-quote-inhibit-functions): New abnormal
hook variable.
(electric-quote-post-self-insert-function): Run the hook. Remove
use of old 'electric-quote-code-faces' variable.
* test/lisp/electric-tests.el (electric-quote-markdown-in-text)
(electric-quote-markdown-in-code): Adapt unit tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/electric-tests.el | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 6f63d30e755..9dd27661d46 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el | |||
| @@ -697,16 +697,24 @@ baz\"\"" | |||
| 697 | (define-electric-pair-test electric-quote-markdown-in-text | 697 | (define-electric-pair-test electric-quote-markdown-in-text |
| 698 | "" "'" :expected-string "’" :expected-point 2 | 698 | "" "'" :expected-string "’" :expected-point 2 |
| 699 | :modes '(text-mode) | 699 | :modes '(text-mode) |
| 700 | :fixture-fn #'electric-quote-local-mode | 700 | :fixture-fn (lambda () |
| 701 | :bindings '((electric-quote-code-faces font-lock-constant-face)) | 701 | (electric-quote-local-mode) |
| 702 | (add-hook 'electric-quote-inhibit-functions | ||
| 703 | (lambda () | ||
| 704 | (save-excursion (search-backward "`" nil t))) | ||
| 705 | nil :local)) | ||
| 702 | :test-in-comments nil :test-in-strings nil) | 706 | :test-in-comments nil :test-in-strings nil) |
| 703 | 707 | ||
| 704 | (define-electric-pair-test electric-quote-markdown-in-code | 708 | (define-electric-pair-test electric-quote-markdown-in-code |
| 705 | #("`a`" 1 2 (face font-lock-constant-face)) "-'" | 709 | #("`a`" 1 2 (face font-lock-constant-face)) "-'" |
| 706 | :expected-string "`'a`" :expected-point 3 | 710 | :expected-string "`'a`" :expected-point 3 |
| 707 | :modes '(text-mode) | 711 | :modes '(text-mode) |
| 708 | :fixture-fn #'electric-quote-local-mode | 712 | :fixture-fn (lambda () |
| 709 | :bindings '((electric-quote-code-faces font-lock-constant-face)) | 713 | (electric-quote-local-mode) |
| 714 | (add-hook 'electric-quote-inhibit-functions | ||
| 715 | (lambda () | ||
| 716 | (save-excursion (search-backward "`" nil t))) | ||
| 717 | nil :local)) | ||
| 710 | :test-in-comments nil :test-in-strings nil) | 718 | :test-in-comments nil :test-in-strings nil) |
| 711 | 719 | ||
| 712 | (provide 'electric-tests) | 720 | (provide 'electric-tests) |