aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/textmodes/tex-mode.el47
1 files changed, 26 insertions, 21 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index e8bc1400a3a..d4885e4e009 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -3369,7 +3369,6 @@ There might be text before point."
3369 ("\\neg" . ?¬) 3369 ("\\neg" . ?¬)
3370 ("\\neq" . ?≠) 3370 ("\\neq" . ?≠)
3371 ("\\nequiv" . ?≢) 3371 ("\\nequiv" . ?≢)
3372 ("\\newline" . ?
)
3373 ("\\nexists" . ?∄) 3372 ("\\nexists" . ?∄)
3374 ("\\ngeq" . ?≱) 3373 ("\\ngeq" . ?≱)
3375 ("\\ngeqq" . ?≱) 3374 ("\\ngeqq" . ?≱)
@@ -3840,32 +3839,38 @@ There might be text before point."
3840 ("\\S" . ?§) 3839 ("\\S" . ?§)
3841 ("\\Finv" . ?Ⅎ) 3840 ("\\Finv" . ?Ⅎ)
3842 ("\\Game" . ?⅁) 3841 ("\\Game" . ?⅁)
3843 ("\\ " . 9141) ; Literal ? breaks indentation 3842 ("\\ " . ?␣) ; Use ? (OPEN BOX) and not ?⎵ (BOTTOM SQUARE BRACKET)
3844 ("\\lvert" . ?|) 3843 ("\\lvert" . ?|)
3845 ("\\rvert" . ?|) 3844 ("\\rvert" . ?|)
3846 ("\\lVert" . ?‖) 3845 ("\\lVert" . ?‖)
3847 ("\\rVert" . ?‖)) 3846 ("\\rVert" . ?‖))
3848 "A `prettify-symbols-alist' usable for (La)TeX modes.") 3847 "A `prettify-symbols-alist' usable for (La)TeX modes.")
3849 3848
3850(defun tex--prettify-symbols-compose-p (_start end _match) 3849(defun tex--prettify-symbols-compose-p (start end _match)
3851 (or 3850 (if (save-excursion
3852 ;; If the matched symbol doesn't end in a word character, then we 3851 (goto-char start)
3853 ;; simply allow composition. The symbol is probably something like 3852 ;; Skip composition when the control backslash at START is
3854 ;; \|, \(, etc. 3853 ;; itself escaped, as in constructs like \"\\\\S\".
3855 (not (eq ?w (char-syntax (char-before end)))) 3854 (not (zerop (mod (skip-chars-backward "\\\\") 2))))
3856 ;; Else we look at what follows the match in order to decide. 3855 nil
3857 (let* ((after-char (char-after end)) 3856 (or
3858 (after-syntax (char-syntax after-char))) 3857 ;; If the matched symbol doesn't end in a word character, then we
3859 (not (or 3858 ;; simply allow composition. The symbol is probably something like
3860 ;; Don't compose \alpha@foo. 3859 ;; \|, \(, etc.
3861 (eq after-char ?@) 3860 (not (eq ?w (char-syntax (char-before end))))
3862 ;; The \alpha in \alpha2 or \alpha-\beta may be composed but 3861 ;; Else we look at what follows the match in order to decide.
3863 ;; of course \alphax may not. 3862 (let* ((after-char (char-after end))
3864 (and (eq after-syntax ?w) 3863 (after-syntax (char-syntax after-char)))
3865 (not (memq after-char 3864 (not (or
3866 '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\")))) 3865 ;; Don't compose \alpha@foo.
3867 ;; Don't compose inside verbatim blocks. 3866 (eq after-char ?@)
3868 (eq 2 (nth 7 (syntax-ppss)))))))) 3867 ;; The \alpha in \alpha2 or \alpha-\beta may be composed but
3868 ;; of course \alphax may not.
3869 (and (eq after-syntax ?w)
3870 (not (memq after-char
3871 '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\"))))
3872 ;; Don't compose inside verbatim blocks.
3873 (eq 2 (nth 7 (syntax-ppss)))))))))
3869 3874
3870 3875
3871;;; Flymake support 3876;;; Flymake support