[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Syntax classes of text in href
From: |
Arash Esbati |
Subject: |
Re: Syntax classes of text in href |
Date: |
Wed, 11 Jan 2023 13:55:36 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 |
Al Haji-Ali <abdo.haji.ali@gmail.com> writes:
> If I have the following text in a LaTeX buffer:
>
> \href{ \cmd{test} }
>
> The opening brace of href has syntax class 15 (for generic
> delimiter?), tested by calling `(syntax-after (point))`. While the
> closing brace seems to have syntax class 5 (for closed
> delimiter). Strangely, the opening brace of cmd has the syntax class
> of 4 (opening delimiter) while the closing one has syntax class of 15
> again (for generic delimiter).
Plonk this example in your .tex file and you'll see what's happening:
\href{pre\cmd{test}post}{foo}
> The result is that modes like `show-paren-mode` or
> `rainbow-delimiters` show the braces as mismatched even though that's
> not the case. Calling `(scan-sexps (point) 1)` on the opening brace of
> cmd also throws the error "Unbalanced parenthesis".
That's expected.
> In a simpler command like
>
> \href{Test}
>
> the syntax classes of both the opening and closing braces is generic
> delimiter.
The issue is that the relevant code in font-latex.el, namely
`font-latex-set-syntactic-keywords', matches only a single level of
braces which looks like this:
\href{pre\cmd{test}post}{foo}
^------------^
And then it goes wrong as described above.
> Even though I would argue that they should be opening/closed
> delimiters, at least there are no mismatched delimiters.
I tend to agree; but I'm not familiar enough with the internals for
font-latex.el to say if this can be changed easily.
> I can remove `\href` from `LaTeX-verbatim-macros-with-braces` and call
> `font-latex-set-syntactic-keywords` to get the braces to match, but I
> am wondering if there's a better solution.
We can teach the code to accept one level of braces, but is there a real
use-case for it?
Best, Arash
- Syntax classes of text in href, Al Haji-Ali, 2023/01/11
- Re: Syntax classes of text in href,
Arash Esbati <=
- Re: Syntax classes of text in href, Al Haji-Ali, 2023/01/11
- Re: Syntax classes of text in href, Arash Esbati, 2023/01/11
- Re: Syntax classes of text in href, Ikumi Keita, 2023/01/12
- Re: Syntax classes of text in href, Arash Esbati, 2023/01/12
- Re: Syntax classes of text in href, Ikumi Keita, 2023/01/12
- Re: Syntax classes of text in href, Arash Esbati, 2023/01/12
- Re: Syntax classes of text in href, Ikumi Keita, 2023/01/13
- Re: Syntax classes of text in href, Arash Esbati, 2023/01/13
- Re: Syntax classes of text in href, Ikumi Keita, 2023/01/13
- Re: Syntax classes of text in href, Arash Esbati, 2023/01/13