Hi Tassilo, thanks for your comments and working on the new ELPA
release!

>>>>> Tassilo Horn <t...@gnu.org> writes:
> For me its 220 vs. 233 seconds which is totally acceptable.  Another way
> would be to bump the required Emacs version to 25.1 where we could omit
> all (f)boundp-checks.  Or as a third option, we could only check

>   (fboundp 'prettify-symbols-default-compose-p)

> which is always defined (even directly after emacs -Q) and available
> from 25.1 on where we can assume that prettify-symbols-compose-predicate
> and tex--prettify-symbols-alist are also available.  And then we can
> defer loading tex-mode in VirTeX-common-initialization.

I like the second option, considering that Arash proposed to raise the
minimum supported Emacs version to 25.1. How about the attached patch?

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

>From 169b2a49d59cd06192a728b8a5016f65096a7f6e Mon Sep 17 00:00:00 2001
From: Ikumi Keita <ik...@ikumi.que.jp>
Date: Sun, 10 Apr 2022 16:52:37 +0900
Subject: [PATCH] Make prettification work reliably

Simplify at the same time, assuming to bump required Emacs version to
25.1.

* tex.el (TeX--prettify-symbols-compose-p): Define unconditionally.
(VirTeX-common-initialization): Always enable prettification.
---
 tex.el | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/tex.el b/tex.el
index ca4b8ad3..0187459b 100644
--- a/tex.el
+++ b/tex.el
@@ -3719,14 +3719,12 @@ The algorithm is as follows:
                      answer
                    TeX-default-mode))))))
 
-(when (and (boundp 'tex--prettify-symbols-alist)
-           (boundp 'prettify-symbols-compose-predicate))
-  (defun TeX--prettify-symbols-compose-p (start end match)
-    (and (tex--prettify-symbols-compose-p start end match)
-         (not (let ((face (get-text-property end 'face)))
-                (if (consp face)
-                    (memq 'font-latex-verbatim-face face)
-                  (eq face 'font-latex-verbatim-face)))))))
+(defun TeX--prettify-symbols-compose-p (start end match)
+  (and (tex--prettify-symbols-compose-p start end match)
+       (not (let ((face (get-text-property end 'face)))
+              (if (consp face)
+                  (memq 'font-latex-verbatim-face face)
+                (eq face 'font-latex-verbatim-face))))))
 
 (defun VirTeX-common-initialization ()
   "Perform basic initialization."
@@ -3786,13 +3784,10 @@ The algorithm is as follows:
     (TeX-source-correlate-mode 1))
 
   ;; Prettify Symbols mode
-  (when (fboundp 'TeX--prettify-symbols-compose-p)
-    (set (make-local-variable 'prettify-symbols-alist) tex--prettify-symbols-alist)
-    (TeX--if-macro-fboundp add-function
-        (add-function :override (local 'prettify-symbols-compose-predicate)
-                      #'TeX--prettify-symbols-compose-p)
-      (set (make-local-variable 'prettify-symbols-compose-predicate)
-           #'TeX--prettify-symbols-compose-p)))
+  (require 'tex-mode)
+  (setq-local prettify-symbols-alist tex--prettify-symbols-alist)
+  (add-function :override (local 'prettify-symbols-compose-predicate)
+                #'TeX--prettify-symbols-compose-p)
 
   ;; Standard Emacs completion-at-point support
   (add-hook 'completion-at-point-functions
-- 
2.34.1

Reply via email to