[Top][All Lists]

[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: Sun, 19 Feb 2023 19:50:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi All,

Al Haji-Ali <> writes:

> Thanks! The fontification is indeed better, though a bit inconsistent
> (nevertheless I think the behaviour is better for me personally, even
> with the inconsistency).

Thanks for checking.  Can you please elaborate what you mean the "a bit
inconsistent"?  I'm not sure IIUC.

> This command:
> \href{pre\cmd{test}post}{foo}
> has the correct character class for the braces around `test` and `foo`
> but not the braces of `href` for some reason.

The reason is actually this part of the patch (which was also the
behavior before my change:)

+                  "\\({\\)[^}{]*?"
+                  "\\(?:{[^}{]*}[^}{]*?\\)*"
+                  "\\(" (regexp-quote TeX-esc) "*\\)"
+                  "\\(}\\)"
+                  )
+         (1 "|") (2 ".") (3 "|")))))

So the braces around the argument of \href have the syntax class "string
fence".  And possible backslashes at last chars get the Punctuation
class so they don't mess the fontification by escaping the last }.  This
is working as expected.

> Also, a command like:
> \href{pre\cmd{{my}test}post}{foo}
> changes the font of the href argument completely.

Yes, this part of the patch

+                  "\\(?:{[^}{]*}[^}{]*?\\)*"

means to match only one level of subbraces, and not 2 or more.  Is there
a use-case for this?  We can change it, but in general it makes matching
a little slower (I'm not sure if it has a significant impact on speed

Best, Arash

reply via email to

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