help-texinfo
[Top][All Lists]
Advanced

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

Re: tex-mode.el for setting superscript and subscript face


From: Christopher Dimech
Subject: Re: tex-mode.el for setting superscript and subscript face
Date: Thu, 14 Jan 2021 17:19:54 +0100

I am having a problem introducing the tex-font-lock-keywords
and get the superscript-subscript functionality to work.


> Sent: Thursday, January 14, 2021 at 10:34 PM
> From: "Robert Pluim" <rpluim@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "help-texinfo gnu" <help-texinfo@gnu.org>
> Subject: Re: tex-mode.el for setting superscript and subscript face
>
> >>>>> On Thu, 14 Jan 2021 11:29:34 +0100, Christopher Dimech <dimech@gmx.com> 
> >>>>> said:
> 
>     Christopher> I am working on a minor mode that will use the superscipt 
> and subscript
>     Christopher> functionality for texinfo-mode.
> 
> Well, itʼs easy enough to locate. lisp/tex-mode.el:646
> 
> (defun tex-font-lock-match-suscript (limit)
>   "Match subscript and superscript patterns up to LIMIT."
>   (when (and tex-fontify-script
>            (re-search-forward "[_^] *\\([^\n\\{}]\\|\
> \\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t))
>     (when (match-end 3)
>       (let ((beg (match-beginning 3))
>           (end (save-restriction
>                  (narrow-to-region (point-min) limit)
>                  (condition-case nil (scan-lists (point) 1 1) (error nil)))))
>       (store-match-data (if end
>                             (list (match-beginning 0) end beg end)
>                             (list beg beg beg beg)))))
>     t))
> 
> (defconst tex-font-lock-keywords-3
>   (append tex-font-lock-keywords-2
>         '((tex-font-lock-match-suscript
>            (1 (tex-font-lock-suscript (match-beginning 0)) append))))
>   "Experimental expressions to highlight in TeX modes.")
> 
>



reply via email to

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