bug-auctex
[Top][All Lists]
Advanced

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

Re: [Bug-AUCTeX] fontification of "|" (vertical bar) deliminter


From: Nicolas Richard
Subject: Re: [Bug-AUCTeX] fontification of "|" (vertical bar) deliminter
Date: Tue, 21 Jan 2014 17:27:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hello,

Tassilo Horn <address@hidden> writes:
> Hm, when I find this file
>
> --8<---------------cut here---------------start------------->8---
> \documentclass{memoir}
> \begin{document}
> This is |foo| and this is |bar|.
> \end{document}
> --8<---------------cut here---------------end--------------->8---
>
> neither foo or bar are fontified, although the | is in the syntax alist:

I blame 'past me' for not giving a full recipe.

OTOH adding \usepackage{shortvrb} to your example doesn't fontify either.

In fact, doing:
emacs -q -l auctex ~/tmp/test.tex --eval '(message "%s\n%s" 
font-latex-syntax-alist font-lock-defaults)'
shows that font-latex-syntax-alist has |, but font-lock-defaults doesn't
have it.
Adding --eval '(font-latex-setup)'
will update font-lock-defaults
but doing C-u C-x = on one of the vertical bars will show that the
syntax is still 'symbol'
Modifying the syntax by hand :
(modify-syntax-entry ?| "|")
will indeed modify the syntax, but still no fontification.

*mumble*

OK, I think I get it, now: modifications in font-latex-syntax-alist made
by font-latex-add-to-syntax-alist are not propagated to
font-lock-defaults AND if font-lock-set-defaults is t,
font-lock-syntax-table won't be updated from font-lock-defaults. I had
been testing each independently until now :|

TL;DR: The following patch fixes it, but is it TRT ?

diff --git a/font-latex.el b/font-latex.el
index 6f07766..43d7034 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1134,6 +1134,7 @@ triggers Font Lock to recognize the change."
 ;;         (cons entry (cadddr font-lock-defaults))))
   ;; Tell font-lock about the update.
   (setq font-lock-set-defaults nil)
+  (font-latex-setup) ; updates font-lock-defaults
   (font-lock-set-defaults))
 
 ;;;###autoload

Now that the problem actually works, we may discuss how to fix it ;)

-- 
Nicolas.




reply via email to

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