diff options
| author | Karl Fogel | 2016-08-30 11:14:37 -0500 |
|---|---|---|
| committer | Karl Fogel | 2016-08-30 11:14:37 -0500 |
| commit | 2b404e8391b7ac26b734710d8290a6ef6a2e32b1 (patch) | |
| tree | 8957f34326c5a5b010011bdc87941d4ff0606436 | |
| parent | a9118afcd7d601190c5474820b58289b5ab5cd7e (diff) | |
| download | emacs-2b404e8391b7ac26b734710d8290a6ef6a2e32b1.tar.gz emacs-2b404e8391b7ac26b734710d8290a6ef6a2e32b1.zip | |
Use normal double quotes in TeX / LaTeX comments
* lisp/textmodes/tex-mode.el (tex-insert-quote): When in a comment,
default to inserting a normal double quote (") instead of TeX-style
open (``) or close ('') quote marks.
* etc/NEWS (TeX mode): Note the change.
* test/lisp/electric-tests.el (autowrapping-7): Adjust accordingly.
See this thread for discussion:
https://lists.gnu.org/archive/html/emacs-devel/2016-08/msg00611.html
From: Karl Fogel <kfogel {_AT_} red-bean.com>
To: Emacs Development <emacs-devel {_AT_} gnu.org>
Subject: [PATCH] Have LaTeX mode use normal double quotes in comments.
Date: Mon, 29 Aug 2016 14:44:12 -0500
Message-ID: <87twe3icmr.fsf@red-bean.com>
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 1 | ||||
| -rw-r--r-- | test/lisp/electric-tests.el | 1 |
3 files changed, 5 insertions, 0 deletions
| @@ -1477,6 +1477,9 @@ looking for macro definitions. By default, no symbols are ignored. | |||
| 1477 | 1477 | ||
| 1478 | ** TeX mode | 1478 | ** TeX mode |
| 1479 | 1479 | ||
| 1480 | *** When in a TeX (LaTeX, etc) comment, insert a normal double quote (") | ||
| 1481 | instead of defaulting to TeX-style open (``) or close ('') quote marks. | ||
| 1482 | |||
| 1480 | *** New custom variable 'tex-print-file-extension' to help users who | 1483 | *** New custom variable 'tex-print-file-extension' to help users who |
| 1481 | use PDF instead of DVI. | 1484 | use PDF instead of DVI. |
| 1482 | 1485 | ||
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 710899fa30d..4430fd64969 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -1311,6 +1311,7 @@ inserts \" characters." | |||
| 1311 | ;; | 1311 | ;; |
| 1312 | (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\)) | 1312 | (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\)) |
| 1313 | (eq (get-text-property (point) 'face) 'tex-verbatim) | 1313 | (eq (get-text-property (point) 'face) 'tex-verbatim) |
| 1314 | (nth 4 (syntax-ppss)) ; non-nil if point is in a TeX comment | ||
| 1314 | ;; Discover if a preceding occurrence of `tex-open-quote' | 1315 | ;; Discover if a preceding occurrence of `tex-open-quote' |
| 1315 | ;; should be morphed to a normal double quote. | 1316 | ;; should be morphed to a normal double quote. |
| 1316 | ;; | 1317 | ;; |
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index afd707667b8..17b4e024ab2 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el | |||
| @@ -578,6 +578,7 @@ baz\"\"" | |||
| 578 | (define-electric-pair-test autowrapping-7 | 578 | (define-electric-pair-test autowrapping-7 |
| 579 | "foo" "\"" :expected-string "``foo''" :expected-point 8 | 579 | "foo" "\"" :expected-string "``foo''" :expected-point 8 |
| 580 | :modes '(tex-mode) | 580 | :modes '(tex-mode) |
| 581 | :test-in-comments nil | ||
| 581 | :fixture-fn #'(lambda () | 582 | :fixture-fn #'(lambda () |
| 582 | (electric-pair-mode 1) | 583 | (electric-pair-mode 1) |
| 583 | (goto-char (point-max)) | 584 | (goto-char (point-max)) |