summaryrefslogtreecommitdiff
path: root/lisp/textmodes/tex-mode.el
diff options
context:
space:
mode:
authorAnders Lindgren <andlind@gmail.com>2015-10-28 12:13:18 +0100
committerAnders Lindgren <andlind@gmail.com>2015-10-28 12:13:18 +0100
commite69f7770611d85e130806763a46db7e212bc952f (patch)
tree96bdd02003f21cea72a604d8f14a06ff99cd9744 /lisp/textmodes/tex-mode.el
parent0392e241b844487261d4dfcccc9a442793e0a868 (diff)
parentcc587a3539612d250d222363b18d15258e33f82a (diff)
downloademacs-e69f7770611d85e130806763a46db7e212bc952f.tar.gz
Merge branch 'master' of /Volumes/HD2/build/emacs-git-ssh
Diffstat (limited to 'lisp/textmodes/tex-mode.el')
-rw-r--r--lisp/textmodes/tex-mode.el30
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."
"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 \alpha@foo.
- (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 \alpha@foo.
+ (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)