diff options
| author | Tassilo Horn | 2015-10-28 08:47:26 +0100 |
|---|---|---|
| committer | Tassilo Horn | 2015-10-28 08:47:26 +0100 |
| commit | 6e2a4021d3fc0166b72c60088fb2cea01484453c (patch) | |
| tree | 6f76b417577e23fe805ebeadcf8009d255795155 | |
| parent | 9db11fa2d635935318364370f31821023c2501b9 (diff) | |
| download | emacs-6e2a4021d3fc0166b72c60088fb2cea01484453c.tar.gz emacs-6e2a4021d3fc0166b72c60088fb2cea01484453c.zip | |
Prettify TeX macros not ending in a word char
* lisp/textmodes/tex-mode.el (tex--prettify-symbols-compose-p): Prettify
macros which don't end in a word character.
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 45afafc2381..0b13759b9bc 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -3410,18 +3410,24 @@ There might be text before point." | |||
| 3410 | "A `prettify-symbols-alist' usable for (La)TeX modes.") | 3410 | "A `prettify-symbols-alist' usable for (La)TeX modes.") |
| 3411 | 3411 | ||
| 3412 | (defun tex--prettify-symbols-compose-p (_start end _match) | 3412 | (defun tex--prettify-symbols-compose-p (_start end _match) |
| 3413 | (let* ((after-char (char-after end)) | 3413 | (or |
| 3414 | (after-syntax (char-syntax after-char))) | 3414 | ;; If the matched symbol doesn't end in a word character, then we |
| 3415 | (not (or | 3415 | ;; simply allow composition. The symbol is probably something like |
| 3416 | ;; Don't compose \alpha@foo. | 3416 | ;; \|, \(, etc. |
| 3417 | (eq after-char ?@) | 3417 | (not (eq ?w (char-syntax (char-before end)))) |
| 3418 | ;; The \alpha in \alpha2 or \alpha-\beta may be composed but | 3418 | ;; Else we look at what follows the match in order to decide. |
| 3419 | ;; of course \alphax may not. | 3419 | (let* ((after-char (char-after end)) |
| 3420 | (and (eq after-syntax ?w) | 3420 | (after-syntax (char-syntax after-char))) |
| 3421 | (not (memq after-char | 3421 | (not (or |
| 3422 | '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\")))) | 3422 | ;; Don't compose \alpha@foo. |
| 3423 | ;; Don't compose inside verbatim blocks. | 3423 | (eq after-char ?@) |
| 3424 | (eq 2 (nth 7 (syntax-ppss))))))) | 3424 | ;; The \alpha in \alpha2 or \alpha-\beta may be composed but |
| 3425 | ;; of course \alphax may not. | ||
| 3426 | (and (eq after-syntax ?w) | ||
| 3427 | (not (memq after-char | ||
| 3428 | '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\")))) | ||
| 3429 | ;; Don't compose inside verbatim blocks. | ||
| 3430 | (eq 2 (nth 7 (syntax-ppss)))))))) | ||
| 3425 | 3431 | ||
| 3426 | (run-hooks 'tex-mode-load-hook) | 3432 | (run-hooks 'tex-mode-load-hook) |
| 3427 | 3433 | ||