GNU bug report logs -
#63441
Wrong Indentation with backslash in verb macros with braces
Previous Next
Reported by: Arash Esbati <arash <at> gnu.org>
Date: Thu, 11 May 2023 08:37:02 UTC
Severity: normal
Done: Arash Esbati <arash <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi all,
I just installed a change (commit 0cb158fd96) which improves
fontification of arguments of verb macros with braces. One addition is
also handling of backslash(es) as last character(s) in the argument.
There is a downside, though. Consider the following file:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{url}
\begin{document}
This is text with \textbf{foo\}
bar}
\path{foobar\}
next line
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---
Now mark the text body and indent with 'M-x indent-region RET' or with
C-M-\ and you get:
--8<---------------cut here---------------start------------->8---
This is text with \textbf{foo\}
bar}
\path{foobar\}
next line
--8<---------------cut here---------------end--------------->8---
which is wrong. This is due to the implementation of
`TeX-brace-count-line' which presumes that ?\\ always escapes the next
char, which is wrong in verb macros. I can think of a solution like
this:
--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index b862d3c2..4663b217 100644
--- a/tex.el
+++ b/tex.el
@@ -5485,7 +5485,9 @@ additional characters."
(setq count (- count TeX-brace-indent-level)))
((eq char ?\\)
(when (< (point) limit)
- (forward-char)
+ (unless (and (fboundp 'LaTeX-verbatim-p)
+ (LaTeX-verbatim-p))
+ (forward-char))
t))))))
count)))
--8<---------------cut here---------------end--------------->8---
Any comments oder better approaches?
Best, Arash
This bug report was last modified 2 years and 12 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.