emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 6e2a402: Prettify TeX macros not ending in a word c


From: Tassilo Horn
Subject: [Emacs-diffs] master 6e2a402: Prettify TeX macros not ending in a word char
Date: Wed, 28 Oct 2015 07:50:16 +0000

branch: master
commit 6e2a4021d3fc0166b72c60088fb2cea01484453c
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    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.
---
 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 45afafc..0b13759 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -3410,18 +3410,24 @@ There might be text before point."
   "A `prettify-symbols-alist' usable for (La)TeX modes.")
 
 (defun tex--prettify-symbols-compose-p (_start end _match)
-  (let* ((after-char (char-after end))
-         (after-syntax (char-syntax after-char)))
-    (not (or
-          ;; Don't compose address@hidden
-          (eq after-char ?@)
-          ;; The \alpha in \alpha2 or \alpha-\beta may be composed but
-          ;; of course \alphax may not.
-          (and (eq after-syntax ?w)
-               (not (memq after-char
-                          '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\"))))
-          ;; Don't compose inside verbatim blocks.
-         (eq 2 (nth 7 (syntax-ppss)))))))
+  (or
+   ;; If the matched symbol doesn't end in a word character, then we
+   ;; simply allow composition.  The symbol is probably something like
+   ;; \|, \(, etc.
+   (not (eq ?w (char-syntax (char-before end))))
+   ;; Else we look at what follows the match in order to decide.
+   (let* ((after-char (char-after end))
+          (after-syntax (char-syntax after-char)))
+     (not (or
+           ;; Don't compose address@hidden
+           (eq after-char ?@)
+           ;; The \alpha in \alpha2 or \alpha-\beta may be composed but
+           ;; of course \alphax may not.
+           (and (eq after-syntax ?w)
+                (not (memq after-char
+                           '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\"))))
+           ;; Don't compose inside verbatim blocks.
+           (eq 2 (nth 7 (syntax-ppss))))))))
 
 (run-hooks 'tex-mode-load-hook)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]