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: Tassilo Horn
Subject: Re: [Bug-AUCTeX] fontification of "|" (vertical bar) deliminter
Date: Wed, 22 Jan 2014 14:26:33 +0100
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

"Nicolas Richard" <address@hidden> writes:

Hi Nicolas,

> 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))

Yes, I think it is.  Also the `font-lock-set-defaults' call can be
omitted then.

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

I think, I've already fixed it.  I've basically applied your patch but
also removed the `font-lock-set-defaults' call (and the FIXME-commented
code before, which seemed like it was dealing with the same issue as
calling `font-latex-setup' now does).

Additionally, I've changed the default value of `LaTeX-shortvrb-chars'
to nil, because just \usepackage{shortvrb} (directly or indirectly thru
memoir) won't make | a short verbatim char.  You need to add
\MakeShortVrb{\|} to your document to get that behavior.

Now also its docstring states that you'd usually set this variable
buffer-locally only and demonstrates how to do it.

Honestly, this is a cheap fix.  The sophisticated correction would be to
add a shortvrb type to the auto-parser so that `LaTeX-shortvrb-chars'
always contains exactly those chars for which a \MakeShortVrb{...}
exists in the document.  I've not done this because it seems a bit
heavyweight just for the sake of getting |foo| highlighted.

Bye,
Tassilo



reply via email to

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