GNU bug report logs -
#57516
Fontification of single brace in an optional argument
Previous Next
Reported by: Arash Esbati <arash <at> gnu.org>
Date: Thu, 1 Sep 2022 09:33:02 UTC
Severity: normal
Done: Arash Esbati <arash <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57516 in the body.
You can then email your comments to 57516 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-auctex <at> gnu.org
:
bug#57516
; Package
auctex
.
(Thu, 01 Sep 2022 09:33:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Arash Esbati <arash <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-auctex <at> gnu.org
.
(Thu, 01 Sep 2022 09:33:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi all,
please consider this artificial but valid LaTeX code:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\numlist[list-separator={[ }]{0.1;0.2;0.3}
Some text here
\numlist[list-separator={] }]{0.1;0.2;0.3}
\numlist[list-separator={; }]{0.1;0.2;0.3}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---
which looks like this with emacs -Q and vanilla AUCTeX:
[font-latex.png (image/png, inline)]
[Message part 3 (text/plain, inline)]
Note how the first {[ } extends the fontification until the next {] }.
I think the issue is in the function `font-latex-find-matching-close',
but I don't have an idea how to fix this. Any takers?
Best, Arash
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#57516
; Package
auctex
.
(Tue, 21 May 2024 11:33:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 57516 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Arash Esbati <arash <at> gnu.org> writes:
> Note how the first {[ } extends the fontification until the next {] }.
> I think the issue is in the function `font-latex-find-matching-close',
> but I don't have an idea how to fix this. Any takers?
I think we have a taker. With the following patch:
--8<---------------cut here---------------start------------->8---
diff --git a/font-latex.el b/font-latex.el
index ccddd8b1..d814642a 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1473,12 +1473,21 @@ ignored during the search."
;; closing brace gets a comment end syntax.
;; (2022 Mar) The latter half of the above paragraph no longer
;; applies since we changed the way to fontify ^^A comment.
- (parse-sexp-lookup-properties nil))
+ (parse-sexp-lookup-properties nil)
+ (syntax (TeX-search-syntax-table openchar closechar)))
(or
(condition-case nil
(progn
- (goto-char (with-syntax-table
- (TeX-search-syntax-table openchar closechar)
+ ;; It is possible to have an opt. arg like \foo[key={]}].
+ ;; Since braces are always balanced in opt. arguments, we
+ ;; change the syntax to "generic comment delimiter". For the
+ ;; backslash, we switch to "/" in order to ignore things like
+ ;; \{ and \}:
+ (unless (and (= openchar ?\{) (= closechar ?\}))
+ (modify-syntax-entry ?\{ "|" syntax)
+ (modify-syntax-entry ?\} "|" syntax)
+ (modify-syntax-entry ?\\ "/" syntax))
+ (goto-char (with-syntax-table syntax
(scan-sexps (point) 1)))
;; No error code. See if closechar is unquoted
(save-excursion
--8<---------------cut here---------------end--------------->8---
the .tex file in the other message looks like this with "emacs -Q":
[font-latex.png (image/png, inline)]
[Message part 3 (text/plain, inline)]
The change also passes the tests. Any comments welcome.
Best, Arash
Reply sent
to
Arash Esbati <arash <at> gnu.org>
:
You have taken responsibility.
(Mon, 27 May 2024 15:27:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Arash Esbati <arash <at> gnu.org>
:
bug acknowledged by developer.
(Mon, 27 May 2024 15:27:03 GMT)
Full text and
rfc822 format available.
Message #13 received at 57516-done <at> debbugs.gnu.org (full text, mbox):
Arash Esbati <arash <at> gnu.org> writes:
> I think we have a taker. With the following patch:
>
> diff --git a/font-latex.el b/font-latex.el
> index ccddd8b1..d814642a 100644
> --- a/font-latex.el
> +++ b/font-latex.el
> @@ -1473,12 +1473,21 @@ ignored during the search."
> ;; closing brace gets a comment end syntax.
> ;; (2022 Mar) The latter half of the above paragraph no longer
> ;; applies since we changed the way to fontify ^^A comment.
> - (parse-sexp-lookup-properties nil))
> + (parse-sexp-lookup-properties nil)
> + (syntax (TeX-search-syntax-table openchar closechar)))
> (or
> (condition-case nil
> (progn
> - (goto-char (with-syntax-table
> - (TeX-search-syntax-table openchar closechar)
> + ;; It is possible to have an opt. arg like \foo[key={]}].
> + ;; Since braces are always balanced in opt. arguments, we
> + ;; change the syntax to "generic comment delimiter". For the
> + ;; backslash, we switch to "/" in order to ignore things like
> + ;; \{ and \}:
> + (unless (and (= openchar ?\{) (= closechar ?\}))
> + (modify-syntax-entry ?\{ "|" syntax)
> + (modify-syntax-entry ?\} "|" syntax)
> + (modify-syntax-entry ?\\ "/" syntax))
> + (goto-char (with-syntax-table syntax
> (scan-sexps (point) 1)))
> ;; No error code. See if closechar is unquoted
> (save-excursion
>
> the .tex file in the other message looks like this with "emacs -Q":
>
> The change also passes the tests. Any comments welcome.
No further comments, so I installed the change, closing.
Best, Arash
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 25 Jun 2024 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 317 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.