From 2649105ae30edf97ac5f543b269886103c42c91c Mon Sep 17 00:00:00 2001
From: Tassilo Horn <tsdh@gnu.org>
Date: Fri, 21 Aug 2015 20:18:34 +0200
Subject: [PATCH] Use add-function for prettify-symbols-compose-predicate

* lisp/textmodes/tex-mode.el (tex-common-initialization): Set
prettify-symbols-compose-predicate in terms of add-function.

* etc/NEWS: Mention prettify-symbols-compose-predicate and
prettify-symbols-mode support in tex-mode.
---
 etc/NEWS                   | 11 +++++++++++
 lisp/textmodes/tex-mode.el |  3 ++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 17a6c3a0828..72af95e8de5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -301,6 +301,13 @@ standards.
 ** Prog mode has some support for multi-mode indentation.
 See `prog-indentation-context' and `prog-widen'.
 
+** Prettify Symbols mode supports custom composition predicates.  By
+overriding the default `prettify-symbols-compose-predicate', modes can
+specify in which contexts a symbol map be composed to some unicode
+character.  `prettify-symbols-default-compose-p' is the default which
+is suitable for most programming languages such as C or Lisp (but not
+(La)TeX).
+
 ** New `xterm-screen-extra-capabilities' config.
 
 ** The `save-place' variable is replaced by a `save-place-mode'.
@@ -694,6 +701,10 @@ name patterns (e.x. all "FOR_DOXYGEN_ONLY_*") to be excluded.
 *** New custom variable `tex-print-file-extension' to help users who
 use PDF instead of DVI.
 
+*** TeX mode now supports Prettify Symbols mode.  When enabling
+`prettify-symbols-mode' in a tex-mode buffer, \alpha ... \omega, and
+many other math macros are displayed using unicode characters.
+
 ** whitespace-mode: new 'big-indent style highlighting too much indentation.
 By default, 32 spaces and four TABs are considered to be too much but
 `whitespace-big-indent-regexp' can be configured to change that.
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 8f68c71fd17..78cfbeaf895 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1256,7 +1256,8 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook
 		(font-lock-unfontify-region-function
 		 . tex-font-lock-unfontify-region)))
   (setq-local prettify-symbols-alist tex--prettify-symbols-alist)
-  (setq-local prettify-symbols-compose-predicate #'tex--prettify-symbols-compose-p)
+  (add-function :override (local 'prettify-symbols-compose-predicate)
+                #'tex--prettify-symbols-compose-p)
   (setq-local syntax-propertize-function
 	      (syntax-propertize-rules latex-syntax-propertize-rules))
   ;; TABs in verbatim environments don't do what you think.
-- 
2.39.5