[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] fontification question
From: |
Mosè Giordano |
Subject: |
Re: [AUCTeX] fontification question |
Date: |
Fri, 28 Apr 2017 13:38:27 +0200 |
I think that start writing tests for fontification may be a good idea
at some point ;-) Fontification tends to be often broken and it's
hard to understand what was actually broken and what's the status-quo
that we want to preserve.
Bye,
Mosè
2017-04-28 13:32 GMT+02:00 Arash Esbati <address@hidden>:
> Arash Esbati <address@hidden> writes:
>
>> Tassilo Horn <address@hidden> writes:
>>
>>> Ah, right. Well, then I guess your patch makes sense. Feel free to
>>> commit it.
>>
>> Done. Best, Arash
>
> Well, I have found one use-case where the patch still doesn't fit: expl3
> syntax. Please consider this snippet:
>
> \cs_new:Npn \foo_bar:Nn #1#2
> {
> \cs_if_exist:NTF #1
> { \__foo_bar:n {#2} }
> { \__foo_bar:nn {#2} { literal } }
> }
>
> Current code doesn't work on \__foo_bar:n. My plan is to install this
> patch:
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/font-latex.el b/font-latex.el
> index ea3e829a..2f662965 100644
> --- a/font-latex.el
> +++ b/font-latex.el
> @@ -1782,6 +1782,11 @@ marks boundaries for searching for group ends."
> (throw 'extend group-start)))))
> nil)))
>
> +(defvar font-latex-match-simple-exclude-list
> + '("-" "," "/" "&" "#" "_")
> + "List of characters directly after \"\\\" excluded from fontification.
> +Each character is a string.")
> +
> (defun font-latex-match-simple-command (limit)
> "Search for command like \\foo before LIMIT."
> ;; \s_ matches chars with symbol syntax, \sw chars with word syntax, \s.
> chars
> @@ -1793,7 +1798,10 @@ marks boundaries for searching for group ends."
> "\\\\\\(\\s_\\|\\sw\\|\\s.\\)\\(?:\\s_\\|\\sw\\)*" limit
> t)))
> (pos (funcall search)))
> (while (and pos
> - (member (match-string 1) '("-" "," "/" "&" "#" "_")))
> + (member (match-string 1)
> + (if (eq major-mode 'doctex-mode)
> + (remove "_" font-latex-match-simple-exclude-list)
> + font-latex-match-simple-exclude-list)))
> (setq pos (funcall search)))
> pos))
> --8<---------------cut here---------------end--------------->8---
>
> Then it works at least in doctex-mode. I'm reluctant to include
> something like this in expl3.el:
>
> (set (make-local-variable 'font-latex-match-simple-exclude-list)
> (remove "_" font-latex-match-simple-exclude-list))
>
> It breaks too much for little benefit. I will also contact the author
> of expl3.el; he tends to have good ideas :-)
>
> Best, Arash
>
- Re: [AUCTeX] fontification question, (continued)
- Re: [AUCTeX] fontification question, Tassilo Horn, 2017/04/21
- Re: [AUCTeX] fontification question, Arash Esbati, 2017/04/24
- Re: [AUCTeX] fontification question, Arash Esbati, 2017/04/25
- Re: [AUCTeX] fontification question, Tassilo Horn, 2017/04/25
- Re: [AUCTeX] fontification question, Arash Esbati, 2017/04/25
- Re: [AUCTeX] fontification question, Tassilo Horn, 2017/04/27
- Re: [AUCTeX] fontification question, Arash Esbati, 2017/04/27
- Re: [AUCTeX] fontification question, Tassilo Horn, 2017/04/27
- Re: [AUCTeX] fontification question, Arash Esbati, 2017/04/27
- Re: [AUCTeX] fontification question, Arash Esbati, 2017/04/28
- Re: [AUCTeX] fontification question,
Mosè Giordano <=
- Re: [AUCTeX] fontification question, Arash Esbati, 2017/04/28